Thread overview
Alternative /hipster/ syntaxes for D
Mar 29, 2012
ezdiy
Mar 29, 2012
simendsjo
Mar 29, 2012
ezdiy
Mar 29, 2012
deadalnix
Mar 29, 2012
ezdiy
Mar 29, 2012
Iain Buclaw
Mar 29, 2012
deadalnix
Mar 29, 2012
Iain Buclaw
March 29, 2012
Hello,

D syntax being C-ish one is great for oldschool class of programmers coming C/C++/Java/C# backgrounds, and although it's quite conscise one compared to, eg. javas, it's still much on the overly verbose side for some people (ie. at least for me :)

The question is, how one would go around to successfully implement an alternative modern syntax to "fix" this. Are there some attempts out there?

I'm talking among the lines of translators for popular languages such as Lua (http://moonscript.org/) or Javascript (http://coffeescript.org/). For statically typed example, take a look at http://live.gnome.org/Genie for Vala.

My idea is something like: try to keep as much of original D grammar as possible, but add a lot of syntactic sugar, f.e.:

- strip perceived "bloat" - by default, all variables auto, only basics of OO (everything virtual and public..) exposed etc...
- python's indentation blocks, instead of {}
- line decorators, such as: a = b if c
- multiple return values (either hack the compiler to have em, or add *a lot* of boilerplate to the translator to use tuples)
- your ideas?

Another issue is how to go around implementation. My bet is to start with some already existing 1:1 D translator which has an actual AST state (is there something like that?) and then try to retrofit it with as much of the hipster stuff until things start to get overly ambiguous :)
March 29, 2012
On Thu, 29 Mar 2012 11:47:54 +0200, ezdiy <eezdiy@gmail.com> wrote:

> Hello,
>
> D syntax being C-ish one is great for oldschool class of programmers coming C/C++/Java/C# backgrounds, and although it's quite conscise one compared to, eg. javas, it's still much on the overly verbose side for some people (ie. at least for me :)
>
> The question is, how one would go around to successfully implement an alternative modern syntax to "fix" this. Are there some attempts out there?
>
> I'm talking among the lines of translators for popular languages such as Lua (http://moonscript.org/) or Javascript (http://coffeescript.org/). For statically typed example, take a look at http://live.gnome.org/Genie for Vala.
>
> My idea is something like: try to keep as much of original D grammar as possible, but add a lot of syntactic sugar, f.e.:
>
> - strip perceived "bloat" - by default, all variables auto, only basics of OO (everything virtual and public..) exposed etc...
> - python's indentation blocks, instead of {}
> - line decorators, such as: a = b if c
> - multiple return values (either hack the compiler to have em, or add *a lot* of boilerplate to the translator to use tuples)
> - your ideas?
>
> Another issue is how to go around implementation. My bet is to start with some already existing 1:1 D translator which has an actual AST state (is there something like that?) and then try to retrofit it with as much of the hipster stuff until things start to get overly ambiguous :)

http://delight.sourceforge.net/
March 29, 2012
On Thursday, 29 March 2012 at 10:06:20 UTC, simendsjo wrote:
> On Thu, 29 Mar 2012 11:47:54 +0200, ezdiy <eezdiy@gmail.com> wrote:
>
>> Hello,
>>
>> D syntax being C-ish one is great for oldschool class of programmers coming C/C++/Java/C# backgrounds, and although it's quite conscise one compared to, eg. javas, it's still much on the overly verbose side for some people (ie. at least for me :)
>>
>> The question is, how one would go around to successfully implement an alternative modern syntax to "fix" this. Are there some attempts out there?
>>
>> I'm talking among the lines of translators for popular languages such as Lua (http://moonscript.org/) or Javascript (http://coffeescript.org/). For statically typed example, take a look at http://live.gnome.org/Genie for Vala.
>>
>> My idea is something like: try to keep as much of original D grammar as possible, but add a lot of syntactic sugar, f.e.:
>>
>> - strip perceived "bloat" - by default, all variables auto, only basics of OO (everything virtual and public..) exposed etc...
>> - python's indentation blocks, instead of {}
>> - line decorators, such as: a = b if c
>> - multiple return values (either hack the compiler to have em, or add *a lot* of boilerplate to the translator to use tuples)
>> - your ideas?
>>
>> Another issue is how to go around implementation. My bet is to start with some already existing 1:1 D translator which has an actual AST state (is there something like that?) and then try to retrofit it with as much of the hipster stuff until things start to get overly ambiguous :)
>
> http://delight.sourceforge.net/

dang, i fail at google once again. thanks!
March 29, 2012
Le 29/03/2012 11:47, ezdiy a écrit :
> Hello,
>
> D syntax being C-ish one is great for oldschool class of programmers
> coming C/C++/Java/C# backgrounds, and although it's quite conscise one
> compared to, eg. javas, it's still much on the overly verbose side for
> some people (ie. at least for me :)
>
> The question is, how one would go around to successfully implement an
> alternative modern syntax to "fix" this. Are there some attempts out there?
>

This isn't a problem. Compare how successful C/C++/Java/C#/PHP/Javascript/Go/Objective-C/ActionScript are compared to languages with « quite concise » syntax. This is a no match.

This style has proven to be readable, convenient and many programmers are used to it. If you want to change that, you don't only need to prove that another syntax is better, but also that it is THAT MUCH BETTER that changing what everybody is used worth it. This sounds difficult to me.
March 29, 2012
On Thursday, 29 March 2012 at 10:49:45 UTC, deadalnix wrote:
> Le 29/03/2012 11:47, ezdiy a écrit :
>> Hello,
>>
>> D syntax being C-ish one is great for oldschool class of programmers
>> coming C/C++/Java/C# backgrounds, and although it's quite conscise one
>> compared to, eg. javas, it's still much on the overly verbose side for
>> some people (ie. at least for me :)
>>
>> The question is, how one would go around to successfully implement an
>> alternative modern syntax to "fix" this. Are there some attempts out there?
>>
>
> This isn't a problem. Compare how successful C/C++/Java/C#/PHP/Javascript/Go/Objective-C/ActionScript are compared to languages with « quite concise » syntax. This is a no match.
>
> This style has proven to be readable, convenient and many programmers are used to it. If you want to change that, you don't only need to prove that another syntax is better, but also that it is THAT MUCH BETTER that changing what everybody is used worth it. This sounds difficult to me.

I'm not here to start flame about old vs new, use irc for that :)

Speaking to the point: Delight seems as a nice concept, however it's awfully implemented (hack of 3years outdated gdc). Such hacks *must* be implemented as code translators for reasons you've cited. Ie i can just generate code for people who refuse to learn something new.
March 29, 2012
On 29 March 2012 11:57, ezdiy <eezdiy@gmail.com> wrote:
> On Thursday, 29 March 2012 at 10:49:45 UTC, deadalnix wrote:
>>
>> Le 29/03/2012 11:47, ezdiy a écrit :
>>>
>>> Hello,
>>>
>>> D syntax being C-ish one is great for oldschool class of programmers coming C/C++/Java/C# backgrounds, and although it's quite conscise one compared to, eg. javas, it's still much on the overly verbose side for some people (ie. at least for me :)
>>>
>>> The question is, how one would go around to successfully implement an alternative modern syntax to "fix" this. Are there some attempts out there?
>>>
>>
>> This isn't a problem. Compare how successful C/C++/Java/C#/PHP/Javascript/Go/Objective-C/ActionScript are compared to languages with « quite concise » syntax. This is a no match.
>>
>> This style has proven to be readable, convenient and many programmers are used to it. If you want to change that, you don't only need to prove that another syntax is better, but also that it is THAT MUCH BETTER that changing what everybody is used worth it. This sounds difficult to me.
>
>
> I'm not here to start flame about old vs new, use irc for that :)
>
> Speaking to the point: Delight seems as a nice concept, however it's awfully implemented (hack of 3years outdated gdc). Such hacks *must* be implemented as code translators for reasons you've cited. Ie i can just generate code for people who refuse to learn something new.

Sounds like literate programming to me.

-- 
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';
March 29, 2012
Le 29/03/2012 13:22, Iain Buclaw a écrit :
> On 29 March 2012 11:57, ezdiy<eezdiy@gmail.com>  wrote:
>> On Thursday, 29 March 2012 at 10:49:45 UTC, deadalnix wrote:
>>>
>>> Le 29/03/2012 11:47, ezdiy a écrit :
>>>>
>>>> Hello,
>>>>
>>>> D syntax being C-ish one is great for oldschool class of programmers
>>>> coming C/C++/Java/C# backgrounds, and although it's quite conscise one
>>>> compared to, eg. javas, it's still much on the overly verbose side for
>>>> some people (ie. at least for me :)
>>>>
>>>> The question is, how one would go around to successfully implement an
>>>> alternative modern syntax to "fix" this. Are there some attempts out
>>>> there?
>>>>
>>>
>>> This isn't a problem. Compare how successful
>>> C/C++/Java/C#/PHP/Javascript/Go/Objective-C/ActionScript are compared to
>>> languages with « quite concise » syntax. This is a no match.
>>>
>>> This style has proven to be readable, convenient and many programmers are
>>> used to it. If you want to change that, you don't only need to prove that
>>> another syntax is better, but also that it is THAT MUCH BETTER that changing
>>> what everybody is used worth it. This sounds difficult to me.
>>
>>
>> I'm not here to start flame about old vs new, use irc for that :)
>>
>> Speaking to the point: Delight seems as a nice concept, however it's awfully
>> implemented (hack of 3years outdated gdc). Such hacks *must* be implemented
>> as code translators for reasons you've cited. Ie i can just generate code
>> for people who refuse to learn something new.
>
> Sounds like literate programming to me.
>

And that isn't really « new ».
March 29, 2012
On 29 March 2012 14:21, deadalnix <deadalnix@gmail.com> wrote:
> Le 29/03/2012 13:22, Iain Buclaw a écrit :
>>
>> On 29 March 2012 11:57, ezdiy<eezdiy@gmail.com>  wrote:
>>>
>>> On Thursday, 29 March 2012 at 10:49:45 UTC, deadalnix wrote:
>>>
>>>>
>>>> Le 29/03/2012 11:47, ezdiy a écrit :
>>>>>
>>>>>
>>>>> Hello,
>>>>>
>>>>> D syntax being C-ish one is great for oldschool class of programmers coming C/C++/Java/C# backgrounds, and although it's quite conscise one compared to, eg. javas, it's still much on the overly verbose side for some people (ie. at least for me :)
>>>>>
>>>>> The question is, how one would go around to successfully implement an alternative modern syntax to "fix" this. Are there some attempts out there?
>>>>>
>>>>
>>>> This isn't a problem. Compare how successful C/C++/Java/C#/PHP/Javascript/Go/Objective-C/ActionScript are compared to languages with « quite concise » syntax. This is a no match.
>>>>
>>>> This style has proven to be readable, convenient and many programmers
>>>> are
>>>> used to it. If you want to change that, you don't only need to prove
>>>> that
>>>> another syntax is better, but also that it is THAT MUCH BETTER that
>>>> changing
>>>> what everybody is used worth it. This sounds difficult to me.
>>>
>>>
>>>
>>> I'm not here to start flame about old vs new, use irc for that :)
>>>
>>> Speaking to the point: Delight seems as a nice concept, however it's
>>> awfully
>>> implemented (hack of 3years outdated gdc). Such hacks *must* be
>>> implemented
>>> as code translators for reasons you've cited. Ie i can just generate code
>>> for people who refuse to learn something new.
>>
>>
>> Sounds like literate programming to me.
>>
>
> And that isn't really « new ».

Or very successful...  however, success is in the eye of the beholder. :~)


-- 
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';