Re: print ambiguity

Paul Prescod <[email protected]>
Newsgroups gmane.comp.lang.prothon.user
Message-ID <[email protected]>
Mark Hahn wrote:

> If you put the word "print' on a line by itself, the meaning is ambiguous
> under the new function-as-command proposal.  It could mean evaluate the
> print function object or it could mean call it.  Since the Parser doesn't
> know which objects are functions, much less which are commands, it would
> have to decide at parse time whether all labels by themselves on a line
> should be attribute evaluations or command function calls.  We need to
> decide.

Maybe the parser shouldn't make the decision. The parser could generate 
some kind of POSSIBLE_COMMAND opcode and then the runtime VM could ask 
the object whether it is a command or not. If it is, it calls it. Else, 
it just returns it. With proper caching and object layout this could be 
  a relatively quick check.

  Paul Prescod
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.