[chuck-users] new operator

Spencer Salazar ssalazar at CS.Princeton.EDU
Sat Oct 21 16:23:49 EDT 2006


Im not totally familiar with 'new', but as I understand it, it is  
mostly used to create 'anonymous' instances of objects.  There is  
very little difference between these two statements:

Object theObject @=> myObjectReference;
new Object @=> myObjectReference;

The single difference is that the first statement also adds a  
reference to the new Object called 'theObject' to the current  
namespace.  So you can access the single object created in that  
statement using theObject.member and also myObjectReference.member.   
The second statement creates an Object that is only accessible by  
myObjectReference.member.

The only similarity to ! is that they are unary operators, i.e. they  
take one operand.

spencer

On Oct 21, 2006, at 3:01 PM, Kassen wrote:

> On 10/21/06, Adam Tindale <adamtindale at hotmail.com> wrote:
> The manual is badly outdated. I am in the process of a major
> revision. Maybe we can start a page on the wiki of things to revise
> in the manual for the next release. If anyone wants to help I would
> greatly appreciate it.
>
>
> Sure. I still don't speak Latex but I'd be happy to add  stuff that  
> pops up on the forum or that I stumble into myself to such a page.
>
> The forum is a good source for such material because there are a  
> lot of people just starting out there and they ask questions if the  
> manual is unclear or outdated.
>
> I'd be happy to write a few paragraphs as well on areas I'm  
> comfortable with.
>
>
> Oh, and could somebody please go into what the word "new" means in  
> ChucK, exactly? It's currently mentioned in the manual exactly once  
> (in that sense). It creates a new instance of a object and it's  
> somehow syntactically similar to "!" and that's about it as far as  
> the manual is concerned. This made the public static classes thing  
> quite hard to understand for me untill Spencer demonstrated a while  
> ago you can get around it (and now I understand that assignment  
> trick).
>
>
> So, great plan, I'd be happy to contribute to this wiki page but  
> we'll still need the list because I predict that the people who  
> discover something is missing from the manual are probably not the  
> people who can write the manual entry....
>
> My cents,
> Kas.
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users



More information about the chuck-users mailing list