[nem-en] () After Method calls
Kenneth Ismert
kismert at sbcglobal.net
Mon Dec 5 16:36:13 CET 2005
> ... Is my understanding correct that in this case the
> compiler understands it as trying to assign a function
> to a var ...
> ... And also some hint should be printed in this case:
> probably you forgot () after the function name...
Thanks, that clears it up for me. The hint would be helpful.
I rather like the requirement for (), even after methods with no
parameters, because it avoids the problem in VB of:
MyString = SomeEntity
Is SomeEntity a function, or a variable? I've resorted to naming the
function fSomeEntity to make the code more readable.
SomeEntity() makes the same point, without having to use a naming
convention.
-Ken
--- devel-en-request at nemerle.org wrote:
> Send devel-en mailing list submissions to
> devel-en at nemerle.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://nemerle.org/mailman/listinfo/devel-en
> or, via email, send a message with subject or body 'help' to
> devel-en-request at nemerle.org
>
> You can reach the person managing the list at
> devel-en-owner at nemerle.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of devel-en digest..."
>
>
> Today's Topics:
>
> 1. Re: devel-en Digest, Vol 24, Issue 1 (Kenneth Ismert)
> 2. Re: Re: devel-en Digest, Vol 24, Issue 1 (Philippe Quesnel)
> 3. Re: Re: devel-en Digest, Vol 24, Issue 1 (Kamil Skalski)
>
>
>
----------------------------------------------------------------------
>
> Message: 1
> Date: Sun, 4 Dec 2005 09:31:35 -0800 (PST)
> From: Kenneth Ismert <kismert at sbcglobal.net>
> Subject: [nem-en] Re: devel-en Digest, Vol 24, Issue 1
> To: devel-en at nemerle.org
> Message-ID: <20051204173136.7777.qmail at web81809.mail.mud.yahoo.com>
> Content-Type: text/plain; charset=iso-8859-1
>
>
> > The problem is you missed () after ToString.
>
> Curses. In VB, it is perfectly OK to drop the () on methods with no
> parameters. The problem is that it is hard for me to see this as an
> error in this new context.
>
> > But this is obviously a bug.
>
> Maybe you could change the message to:
>
> "Hey, idiot, you forgot the () after method ToString."
>
> -Ken
>
>
>
>
> ------------------------------
>
> Message: 2
> Date: Sun, 4 Dec 2005 16:14:45 -0500
> From: Philippe Quesnel <philippe.quesnel at gmail.com>
> Subject: Re: [nem-en] Re: devel-en Digest, Vol 24, Issue 1
> To: devel-en at nemerle.org
> Message-ID:
> <5532db7d0512041314i5c7aed51r4d8406f0c1701593 at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> hmm, a question comes to mind here ...
> Is my understanding correct that in this case the compiler
> understands it as
> trying to assign a function to a var ?
> (ie a 'closure', a Delegate, function ptr etc.) ???
>
>
> On 12/4/05, Kenneth Ismert <kismert at sbcglobal.net> wrote:
> >
> >
> > > The problem is you missed () after ToString.
> >
> > Curses. In VB, it is perfectly OK to drop the () on methods with no
> > parameters. The problem is that it is hard for me to see this as an
> > error in this new context.
> >
> > > But this is obviously a bug.
> >
> > Maybe you could change the message to:
> >
> > "Hey, idiot, you forgot the () after method ToString."
> >
> > -Ken
> >
> >
> > _______________________________________________
> > https://nemerle.org/mailman/listinfo/devel-en
> >
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
>
/mailman/pipermail/devel-en/attachments/20051204/71f3cff3/attachment-0001.html
>
> ------------------------------
>
> Message: 3
> Date: Sun, 4 Dec 2005 22:31:44 +0100
> From: Kamil Skalski <kamil.skalski at gmail.com>
> Subject: Re: [nem-en] Re: devel-en Digest, Vol 24, Issue 1
> To: devel-en at nemerle.org
> Message-ID: <711aea6b0512041331r10781e04u at mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> 2005/12/4, Philippe Quesnel <philippe.quesnel at gmail.com>:
> > hmm, a question comes to mind here ...
> > Is my understanding correct that in this case the compiler
> understands it
> > as
> > trying to assign a function to a var ?
> > (ie a 'closure', a Delegate, function ptr etc.) ???
> >
>
> Exactly. x.ToString is a function of type void -> string and compiler
> is trying to assign such a value to a variable of type string. The
> correct message should be
>
> expected object of type string, while got object of type void->string
>
> And also some hint should be printed in this case:
>
> probably you forgot () after the function name...
>
> --
> Kamil Skalski
> http://nazgul.omega.pl
>
>
>
> ------------------------------
>
> _______________________________________________
> devel-en mailing list
> devel-en at nemerle.org
> https://nemerle.org/mailman/listinfo/devel-en
>
>
> End of devel-en Digest, Vol 24, Issue 2
> ***************************************
>
More information about the devel-en
mailing list