Sudarshan Gaikaiwari wrote:
> methhead: METHOD IDENT LPAREN arglist RPAREN {
>         $$ := Method( , , , , , $2.s, $4, $1.s, $3, $5)
>         } ;
> 
> modify this rule to handle the case where  we have operator tokens
> instead of ident tokens.  Then  translate the operator token to  the 
> predefined name.

Yes. I think this would be fairly easy to implement since you've got
the rest of the work done!  (Anyone feel like experimenting with this?)

>...
> However if we generalize this to perform a proc lookup for all types
> then this will slow the interpretation of the usual code path down.

Hmmm, good point.  How about a different implementation for procedures?
(There's not a lot of thought behind this, so it may be way off base.)
Suppose, in the case of procedure ||, the code for that procedure
*replaced* the code normally used to process ||?  (That part should
be easy, since I'm fairly sure most of the operators are implemented
as functions internally.)  So, it becomes the responsibilty of the
person writing procedure || to handle the 'normal' interpretation.
Something like the following should suffice (he claims):

   procedure ||(a,b)
      if (type(a) == "list") & (type(b) == "list") then
          suspend a|||b
      else suspend "||"(a,b)
   end

This interpretation places more of a burden on the writer of
procedure ||, but it also has the advantage of letting you
override the existing behavior of operators!  e.g.:

   procedure ||(a,b)
      if debugLevel >= X then
         write(&errout, image(a),"||",image(b)," called.")
      suspend "||"(a,b)
   end

(I can imagine there might be more useful things to do here!)

On the other hand, since you could only have a single instance
of an 'operator' procedure, they're not as useful as having
'operator' methods on objects.  So maybe it's not worth worrying
about adding procedure ||(a,b)?

-- 
Steve Wampler -- [EMAIL PROTECTED]
The gods that smiled on your birth are now laughing out loud.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Unicon-group mailing list
Unicon-group@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/unicon-group

Reply via email to