Why is there no or or and ?

F i L witte2008 at gmail.com
Thu Feb 16 22:48:41 PST 2012


Andrei Alexandrescu wrote:
> I figured I won't be able to unread the rest, so I stopped here 
> :o).

Well... my syntax must require a finer taste </posh> ;-p


Jonathan M Davis wrote:
> On Friday, February 17, 2012 06:57:48 F i L wrote:
>> I knew someone was going to say that >:{
>
> Well, you _were_ asking for it. :)
>
> But I do honestly think that it's ugly. Obviously, different 
> people have different ideas of what a language's syntax should 
> look like - frequently strongly influenced by what language or 
> languages they used first. Personally, I _like_ the C style 
> syntax and do not understand why people want to get rid of 
> stuff like braces or semicolons (you didn't get rid of braces 
> in your suggested syntax, but it's a common suggestion for 
> people who don't like C style syntax). Overall, I think that 
> D's syntax is very good.

I started on C++ actually (ahh Codewarrior :)) and still find the 
C (read D/C#) syntax to be the most readable overall, though, 
after navigating the myriad of syntaxes and styles of web design, 
I'm not too picky. But my syntax does have purpose behind it's 
brilliance! For instance, all identifier names are placed at the 
beginning of Lines, which eliminates eyeballing each line to find 
it's definition and keeps accessor keywords (static, public, etc) 
from getting in the way of variable grouping. 'case' is used 
instead of 'if' to keep short, like-kind conditions aligned. 
'else' can be used as 'else if' for the same reason. Contracts 
are kept from bumping up against the definitions (important when 
identifiers are first) and ending marks are largely unneeded in 
the first place.

To eliminate Go's required "{" at the end of body definitions, I 
would make each "free scope" require a scope keyword. This might 
even be useful for something like functions derived of functions 
(not thoroughly thought out):

     foo( age:int )
     {
         before: scope {}

         // foo code

         after: scope
         {
             // default after code
         }
     }

     bar( name:text, age:int ): foo( age )
     {
         // inherited foo code

         scope( after )
         {
             // override after code
         }
     }

I know this is what polymorphism is for, but I think because 
object methods are conceptually "random access" and scopes are 
"in sequence" there might be a (any?) benefit to static function 
inheritance. Maybe in combination with structs or UFCS? Idk, 
maybe i'm just crazy :)


More information about the Digitalmars-d mailing list