Revised RFC on range design for D2

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Wed Oct 1 06:25:31 PDT 2008


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

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.

> 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. (I'll also note that Perl does not abide to economy of syntax
- see Tim Toady and all that.)

> In my prioritization of language-design principles, consistency is more 
> important then syntactic economy.

Mine too. You just got a few terms jumbled.

> Based on those principles, I believe that the parentheses should be 
> mandatory for all function calls.

That needs revision.


Andrei


More information about the Digitalmars-d-announce mailing list