Revised RFC on range design for D2

Bruno Medeiros brunodomedeiros+spam at com.gmail
Thu Oct 2 05:00:15 PDT 2008


Andrei Alexandrescu wrote:
> Benji Smith wrote:
>> Andrei Alexandrescu wrote:
>>> I stated two principles of language design. They could be true or 
>>> false. They are up there for debate. They are subjective, because 
>>> aside from some basics, language design is subjective.
>>>
>>> The principles are:
>>>
>>> 1) A language should minimize the number of syntactic constructs that 
>>> are semantically and/or pragmatically meaningless.
>>>
>>> 2) The more frequently-used constructs should be given syntactic 
>>> priority over the less-used constructs, particularly when the latter 
>>> are also at risk of breaking the first principle.
>>
>> I'd like to propose another principle of language design:
>>
>> 3) Consistency -- The expression of a semantic construct should always 
>> use the same syntax. Likewise, multiple uses of the same syntactic 
>> constructs should always result in the same semantics.
> 
> Consistency is good, but that's not consistency.
> 
> http://www.merriam-webster.com/dictionary/consistency
> 
> agreement or harmony of parts or features to one another or a whole :
> correspondence  ; specifically : ability to be asserted together without
> contradiction
> 

The concept of "consistency" has a more specialized meaning when applied 
to language design. (just has it has in other fields, like mathematics)
So I agree with benji that not having "The expression of a semantic 
construct should always use the same syntax" is not being consistent. 
(There are of course other situations where things can be inconsistent.)

If you don't agree with this definition of "consistency", I'm not gonna 
argue with that , just substitute it with "conzistency" or "foobar", or 
whatever and proceed.

> An example of consistency is that user-defined operators have the same
> syntax and precedence as built-in operators.
> 
>> Based on that principle, I'd argue that function-calling should either 
>> always use parentheses, or it should never use parentheses.
> 
> Yah I'd like that too. It's economy of syntax.
> 

Then why are you not suggesting, or campaigning for, such change?

>> Requiring parentheses for some function calls, but not for others 
>> violates the principle of consistency.
> 
> No. It violates economy of syntax. There are many syntaxes for the same
> semantics. 

It violates consistency, as defined above. It may violate economy of 
syntax as well (or it may be the same thing). Whatever. What I ask is, 
what would you suggest to fix it? Should all function calling not use 
parenthesis? And how would that syntax be?


-- 
Bruno Medeiros - Software Developer, MSc. in CS/E graduate
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D


More information about the Digitalmars-d-announce mailing list