[Mono-list] C sharp syntax [OT?]

Sanin Saracevic ssaracevic@interland.com
Fri, 3 May 2002 00:42:16 -0400


Hi.
According to C-sharp specification (ftp://ftp.ecma.ch/ecma-st/Ecma-334.pdf,
Section 14.2.1 Operator precedence and associativity) both member access (.)
and element access([]) operators belong to the category of primary
operators. Page 139.2 goes on to state that in case of "two operators with
the same precedence, the associativity of the operators controls the order
in which the operations are performed." Since binary operators are
left-associative, it seems clear that the expression of a form E.I[A] is
evaluated from left to right, in which case the original code in question
should compile. Sections 14.5.4 Member access and 14.5.6 Element access have
more information about resolving statements of a form E.I[A]. Am I missing
something here? BTW,MS c# compiler will accept the original statement with
no complaints.

P.S. I have been following your efforts for some time and can say only best
about it. Keep it up.

Sincerely,
Sanin Saracevic


-----Original Message-----
From: Gaurav Vaish
To: James Ots; mono-list@ximian.com
Sent: 5/2/2002 9:34 PM
Subject: Re: [Mono-list] C sharp syntax [OT?]

----- Original Message ----- 
From: "James Ots" <me@jamesots.com>
To: <mono-list@ximian.com>
Sent: Thursday, May 02, 2002 02:27
Subject: [Mono-list] C sharp syntax [OT?]


> 
> while the following is not:
> 
> IPEndPoint ipend = new IPEndPoint( host.AddressList[0], 23 );

    Change it to the following:

    IPEndPoint ipend = new IPEndPoint( (host.AddressList)[0], 23);

Your statement reads the following:

    IPEndPoint ipend = new IPEndPoint( host.(AddressList[0]), 23);

    which is invalid.

HIH

Cheers,
Gaurav Vaish
http://mastergaurav.virtualave.net/iitk
http://calendar.yahoo.com/mastergaurav
-----------------------------------------


> 
> Why is this?
> 
> In IPHostEntry it appears the second format is used, but I get an
error
> message when I do it:
> 
> ./Sock.cs(26) error CS0118: Expression denotes a `property access'
where
> a `variable' was expected
> Error: Compilation failed
> 
> -- 
> Cheers
> James Ots
> 
> 
> 
> _______________________________________________
> Mono-list maillist  -  Mono-list@ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list


_______________________________________________
Mono-list maillist  -  Mono-list@ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list