On Thu, 2004-02-12 at 19:44, Wade Bowmer wrote:

> Sorry, yes, I meant an operator. 

Ah, that's more reasonable.  My point about lexing,parsing etc. is
now moot - I was just pointing out that adding a reference type
is much more involved than just adding a new function.  And it
is a new type - I was confused about the flag in the descriptor.
That 'flag' is the new type (a 'reference' type).

Since it's an operator, we're back to the discussion from a
few weeks ago...

Let's see if we can agree on some general principles:

(1) Since it's an operator, let's use an operator's syntax, say '$'
     (so your x := ref(y) becomes x := $y)

(2) To add $ to the language it needs to have general utility.  By
     that I mean specifically if the sole justification of having
     a reference type is to support pass-by-reference, then perhaps
     that issue should be addressed directly.

(3) There should be no restrictions on where the reference operator
     can be used - it should be allowed in *any* expression.  (This,
     wandering off track, is my complaint about the current 'default
     value' implementation.  It should be possible to use any expression
     to compute the default value, not just constants.)

(4) It must be possible to obtain a reference to *any* variable, not
     just 'named' variables.  e.g. x := $L[n]

(5) It must be type-safe.

Sound reasonable?

Now some questions:

(1) Should deferencing a reference type be implicit or explicit?
    (Unicon has an explicit deference operator already, so there's
    some precedent for this.)

(2) If implicit, then under what conditions does the dereference
     occur?

(3) What uses does a reference type have beyond providing a
     work-around for not having pass-by-reference?  (I know of
     one other - to alias into a structure reference to avoid
     having to repeat the structure reference in the user code.)

(3) Please explain how the implementation would handle the following:

     global x, a
     ...
     f()
     pull(a)
     g()
     ...

     procedure g()
        write(.x)       # I'm assuming explicit deferencing, so it's
     end                   #   easier to discuss...
 

(3a) procedure f()
          local y
          x := $y          # note that y is an offset from the frame
                             #   pointer, and that, (*I think*) if the
call is
                             #   inside a co-expression, then garbage
                             #   collection may change the actual
location of
                             #   the frame in memory.
      end

(3b) procedure f()
           a := [1,2,3,4,5]
           x := $a[5]
      end

(4)  What does x := $$y do?

-Steve
-- 
Steve Wampler <[EMAIL PROTECTED]>


-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
Unicon-group mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/unicon-group

Reply via email to