Revised RFC on range design for D2

Jason House jason.james.house at gmail.com
Tue Sep 30 07:02:55 PDT 2008


KennyTM~ Wrote:

> Jason House wrote:
> > KennyTM~ Wrote:
> > 
> >> Bill Baxter wrote:
> >>> On Tue, Sep 30, 2008 at 3:36 AM, Steven Schveighoffer
> >>> <schveiguy at yahoo.com> wrote:
> >>>>> There is no ambiguity either case. You evaluate Stdout.newline. The
> >>>>> evaluation yields a value of some type. Then you evaluate formatln against
> >>>>> that value.
> >>>> OK, then tell me what this does:
> >>>>
> >>>> x.y.z();
> >>>>
> >>>> Is y a property/field of x or a function call with no args?  I see a benefit
> >>>> to being able to understand a line of code without requiring lots of extra
> >>>> context.  I have to do less lookups of the source of a function or property.
> >>> The problem with this argument is that unless you disallow properties
> >>> altogether, you still won't know whether y is actually a field or a
> >>> call to a property method without looking it up.
> >>>
> >>> --bb
> >> I think the distinction of with and without () is pretty stylistic, 
> >> because the same argument can even be applied to operator overloading 
> >> (does a=b means pointing the variable a to b, or calling a.opAssign(b)?)
> >>
> >> For me, I would use () if the function do modify the object itself.
> >>
> > 
> > I assume you'd also want parens if the function modified global state? If so, I believe you'd want parens with all impure member function calls.
> 
> Right. Therefore if I were to implement property getters I would require 
> it as an immutable (or at least const) method itself.


Const and immutable functions can modify global state... So I don't think you'd want that.

PS: D's const functions don't guarantee they won't modify the object.





> I don't know what's the use of global functions that is pure AND does 
> not take any input.
> 
> > Obviously, we're talking about property getters and not setters. I was told once already that such things are off topic :) I think it's relevant to the spirit of the conversation.



More information about the Digitalmars-d-announce mailing list