[chuck-users] new operator

Kassen signal.automatique at gmail.com
Sat Oct 21 16:50:38 EDT 2006


On 10/21/06, Spencer Salazar <ssalazar at cs.princeton.edu> wrote:
>
>
> The only similarity to ! is that they are unary operators, i.e. they
> take one operand.



Got it.

I just looked it up and page 51 (of the pdf file numbering) is the only
place in the manual that mentions "new" in this sense. It says;

-------------------
! + - new (unary)
These operators come before one operand.

    // logical invert
    if( !true == false )
         <<<"yes">>>;

    // negative
    -1 => int foo;

    // instantiate object
    new object @=> object @ bar;
--------------


That last line could use some explanation as far as I'm concerned.

I understand we are creating a new object and asigning it but then what? The
second "@" is very confusing to me. Eventually it seems to be called "bar"
but then why do we need the "@=>" and mention "object" again? This one line
is used to explain what "new" does and as far as I can tell two forms of
asignment at the same time.

To put it bluntly; that's too much for me in on go without context.

I propose simplifying that line and explaining the principles hinted at in
some more depth in their own sections; I stared at that line for quite a
while.

Kas.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20061021/5c558f9b/attachment-0001.htm 


More information about the chuck-users mailing list