www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Alternative /hipster/ syntaxes for D

reply "ezdiy" <eezdiy gmail.com> writes:
Hello,

D syntax being C-ish one is great for oldschool class of 

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 :)
Mar 29 2012
next sibling parent reply simendsjo <simendsjo gmail.com> writes:
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  

 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/
Mar 29 2012
parent "ezdiy" <eezdiy gmail.com> writes:
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 

 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!
Mar 29 2012
prev sibling parent reply deadalnix <deadalnix gmail.com> writes:
Le 29/03/2012 11:47, ezdiy a écrit :
 Hello,

 D syntax being C-ish one is great for oldschool class of programmers

 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 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.
Mar 29 2012
parent reply "ezdiy" <eezdiy gmail.com> writes:
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

 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 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.
Mar 29 2012
parent reply Iain Buclaw <ibuclaw ubuntu.com> writes:
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 =E9crit :
 Hello,

 D syntax being C-ish one is great for oldschool class of programmers

 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 languages with =AB quite concise =BB syntax. This is a no match. This style has proven to be readable, convenient and many programmers ar=
e
 used to it. If you want to change that, you don't only need to prove tha=
t
 another syntax is better, but also that it is THAT MUCH BETTER that chan=
ging
 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 awfu=
lly
 implemented (hack of 3years outdated gdc). Such hacks *must* be implement=
ed
 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. --=20 Iain Buclaw *(p < e ? p++ : p) =3D (c & 0x0f) + '0';
Mar 29 2012
parent reply deadalnix <deadalnix gmail.com> writes:
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

 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 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 ».
Mar 29 2012
parent Iain Buclaw <ibuclaw ubuntu.com> writes:
On 29 March 2012 14:21, deadalnix <deadalnix gmail.com> wrote:
 Le 29/03/2012 13:22, Iain Buclaw a =E9crit :
 On 29 March 2012 11:57, ezdiy<eezdiy gmail.com> =A0wrote:
 On Thursday, 29 March 2012 at 10:49:45 UTC, deadalnix wrote:

 Le 29/03/2012 11:47, ezdiy a =E9crit :
 Hello,

 D syntax being C-ish one is great for oldschool class of programmers

e
 compared to, eg. javas, it's still much on the overly verbose side fo=
r
 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
to
 languages with =AB quite concise =BB 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 co=
de
 for people who refuse to learn something new.
Sounds like literate programming to me.
And that isn't really =AB new =BB.
Or very successful... however, success is in the eye of the beholder. :~) --=20 Iain Buclaw *(p < e ? p++ : p) =3D (c & 0x0f) + '0';
Mar 29 2012