Replies: 1 comment
-
(I picked #1, I will regret it later - but there's enough stuff that needs to be reworked that this one is a drop in a bucket...) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I knew this was coming, but I'd forgotten.
Foolang uses Lisp/Smalltalk style interned strings, aka selectors aka symbols as message keys / method identifiers, which have an associated literal syntax.
#aMessage sendTo: anObject
is same asanObject aMessage
Plan is that the compiler would not bother emitting code for methods that can never be called - because we know which selectors have no references to them outside the methods identified by them. Smaller code, faster compile times, all good.
This means that there must not be a way for user code to intern selectors at runtime.
Except that the interpreter must be able to do that: otherwise it cannot go from the string
"1 + x"
to executing#+ sendTo: 1 withArguments: [x]
. (The interpreter can intern new selectors just fine by keeping a table of its own, but existing ones are the problem.)There are a few options:
Selector#intern:
for now, and worry about removing it later. (Easy.)SelectorTable
which does the interning: having a reference to it causes there to be a reference to all selectors, preventing the compiler from ignoring methods, etc. (Most work by far.)I'm really temped by number 1, but I know I will regret it later...
Beta Was this translation helpful? Give feedback.
All reactions