Revised RFC on range design for D2

KennyTM~ kennytm at gmail.com
Thu Oct 2 10:32:58 PDT 2008


I think someone should start a new thread on this? The argument is not 
relation to range design at all, and it's getting very difficult to 
watch this huge thread.

------

Andrei Alexandrescu wrote:
> I agree that 4 is a good principle. I'd even call it "consistency" -
> across languages that is. But let's not forget that C# defined an entire
> feature - properties - to fulfill what was perceived as a need.

And the "property" feature, unlike current D, do lift the ambiguity 
between procedures and properties that we (well, some of us) dislike.

I believe we all agree support for property in D is a good thing, but we 
just hate the current syntax (making f equivalent to f() regardless of 
what f is).

Again, for me, if you can restrict obj.f to be a valid getter only to 
pure methods (that won't cause any side effect to content of "this") 
then I'm all set. But probably not the others who demand getters must be 
fast. :)

 > Also the
> Cecil language goes as far as requiring accessors for any field (and

Who uses Cecil? Never heard of it.

> defining methods implicitly when missing). Eiffel also has properties
> that are obtained via syntactic conventions (getX and setX implement
> property x). 

But not making x === x() I afraid. I don't know Eiffel, though.

 > People want to add properties to Java 7 (unfortunately the
> google search is clogged by a Java class called Properties so it needs
> some combing). 

There is an explicit "property" keyword in Java and more importantly, 
properties are accessed using the syntax obj->prop (ugly I know). The 
problem we concerned do not exist.

(Ref: http://www.javalobby.org/java/forums/t88090.html; The Google 
search keyword is "java-7 property")

> 
> I'm impressed a lot by the analogy with math because it is one extra 
> argument in my favor. In math there's no function without arguments. At 
> most people would say f(.) (with a central dot) when referring to what 
> is akin to the address of the function.
> 
> 
> Andrei

Sorry, in math the normal way to represent a function is to just use the 
symbol, i.e. f, e.g. chain rule (f o g)' = g' * f' o g.

The central dot is used only when the "function" is not represented in 
the form f(a,b,c,...), e.g. the commutator [.,.] and the mean <.>. I 
have *never* seen anyone writes f(.).

But I don't think we should directly apply math language to a 
programming language.


More information about the Digitalmars-d-announce mailing list