Prev: Q: Stopping a task running a long simulation
Next: Ensuring postconditions in the face of exceptions
From: Simon Wright on 11 Mar 2010 13:31 Anh Vo <anhvofrcaus(a)gmail.com> writes: > By the way, why put a hollow > parenthesis for nothing. I often get trapped by this in Python. foo() calls the parameterless subprogram foo, foo is its address.
From: Anh Vo on 11 Mar 2010 13:41 On Mar 11, 10:31 am, Simon Wright <si...(a)pushface.org> wrote: > Anh Vo <anhvofrc...(a)gmail.com> writes: > > By the way, why put a hollow > > parenthesis for nothing. > > I often get trapped by this in Python. foo() calls the parameterless > subprogram foo, foo is its address. It is interesting to know this for a Python newbie like me. Thank you for your good info.
From: Anh Vo on 11 Mar 2010 15:09 On Mar 11, 11:01 am, Charmed Snark <sn...(a)cogeco.ca> wrote: > Anh Vo expounded in news:2801d429-d00b-46cb-955a- > To me, with my heretical C background, the "()" is a strong > reminder that a method is being "called". In C/C++, the statement > > Obj.Clear; > > would quietly compile clean (if Clear turned out to be a data > member) and do nothing. > > I do realize that that sort of hijinx doesn't happen around here. > But now you hopefully understand my twisted state of mind. > > Don't worry-- I will assimilate. > Actually, Ada has this notation for ages specially in the tasking area. Here is a incomplete example. .... task type Bus_Monitor is entry Start; entry Stop; end Bus_Monitor; Bus_Mon_Obj : Bus_Monitor; .... Bus_Monitor.Start; .... Anh Vo
From: Robert A Duff on 11 Mar 2010 16:40 Pascal Obry <pascal(a)obry.net> writes: > This is deliberate and was a design decision for unification of access > to variable and function returning a value: > > Is_It_Ok : Boolean; > function Is_It_Good return Boolean; > > Then, from the call side there is no distinction: > > if Is_It_Ok then > > if Is_It_Good then > > It is then possible to replace access to a value by a function without > having to change the code everywhere. Well, except here: Is_It_OK := True; -- OK Is_It_Good := True; -- Illegal! ;-) I think I'd prefer the empty parens. I'd buy the uniformity of reference argument in a pure functional language. But in Ada, function calls can have side effects, whereas variable reads cannot, so I think perhaps a syntactic distinction would be useful. - Bob
From: Jeffrey R. Carter on 11 Mar 2010 19:16 Robert A Duff wrote: > > I think I'd prefer the empty parens. I'd buy the uniformity of > reference argument in a pure functional language. But in Ada, > function calls can have side effects, whereas variable reads > cannot, so I think perhaps a syntactic distinction would be > useful. Ada 80 required them. They avoided some ambiguities that Ada has without them. They were removed in Ada 83 due to widespread dislike. -- Jeff Carter "In the frozen land of Nador they were forced to eat Robin's minstrels, and there was much rejoicing." Monty Python & the Holy Grail 70
|
Next
|
Last
Pages: 1 2 Prev: Q: Stopping a task running a long simulation Next: Ensuring postconditions in the face of exceptions |