Created
March 11, 2025 01:36
-
-
Save osnr/98a344ae8ea9cae8f436c45df4080204 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package require oo | |
set block { | |
class C { | |
procs {} | |
} | |
} | |
set tmp [file tempfile /tmp/blockXXXXXX].tcl | |
set fd [open $tmp w]; puts $fd $block; close $fd | |
eval [read [open $tmp r]] | |
C method proc {name arguments rtype body} { | |
if {[dict exists $procs $name]} { error "C proc: Name collision: $name" } | |
puts "1: proc($name): [dict get [$self classvars] procs]" | |
dict set procs $name rtype $rtype | |
} | |
set cc [C] | |
$cc method insts {} { | |
uplevel set instvars | |
} | |
puts "cc is $cc" | |
$cc proc addify {int a int b} int { | |
return a + b; | |
} | |
puts "GOT: [dict get [::<reference.<C______>.00000000000000000000> classvars] procs]" | |
__exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment