March 21, 2014 Re: Improve D's syntax to make it more python like | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mason McGill | Am 21.03.2014 21:43, schrieb Mason McGill:
> On Friday, 21 March 2014 at 18:47:49 UTC, Pedro Larroy wrote:
>> Hi
>>
>> As a newcomer to D, I wonder, how difficult would be and would it be
>> welcome by the D community to have D's syntax with significant
>> whitespace and without brackets more like python?
>>
>>
>> Thanks.
>
> What draws you to D, if not the syntax? If you're looking for a fast,
> Python-like language, and you don't mind dependence on the CPython
> runtime, I'd suggest looking into Cython (http://cython.org/).
>
> If you're interested in modern language features and expressive
> metaprogramming with a Python-like syntax, I'd recommend Julia
> (http://julialang.org/).
>
> You might also be interested in Dylan (https://opendylan.org/), though I
> don't know much about it.
Dylan could have been a great language. A lisp for systems programming with algol syntax.
Developed at Apple, originally targeted at the Newton.
Since it was newly released as open source it has got some followers, but I am not sure if it will ever manage to get out of "could have been great" status.
--
Paulo
|
March 21, 2014 Re: Improve D's syntax to make it more python like | ||||
---|---|---|---|---|
| ||||
Posted in reply to The Guest | The Guest:
> It's already in progress:
> https://github.com/pplantinga/delight
> http://pplantinga.github.io/
Some design decision are bad, like "less" for "<", or the function definition syntax "function add(int a, b -> int):".
Bye,
bearophile
|
March 21, 2014 Re: Improve D's syntax to make it more python like | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mason McGill | On Friday, 21 March 2014 at 20:43:24 UTC, Mason McGill wrote: > On Friday, 21 March 2014 at 18:47:49 UTC, Pedro Larroy wrote: >> Hi >> >> As a newcomer to D, I wonder, how difficult would be and would it be welcome by the D community to have D's syntax with significant whitespace and without brackets more like python? >> >> >> Thanks. > > What draws you to D, if not the syntax? Definitely not the syntax! The promise of a relatively high level statically typed language with low level control and C/C++ levels of performance. That's what I'm looking for with D. I choke down the syntax, telling myself "at least it's better than C++". > If you're looking for a fast, Python-like language, and you don't mind dependence on the CPython runtime, I'd suggest looking into Cython (http://cython.org/). > > If you're interested in modern language features and expressive metaprogramming with a Python-like syntax, I'd recommend Julia (http://julialang.org/). You're wrong about Julia. The syntax is most reminiscent of MATLAB and Octave. Others are wrong comparing Ruby/Perl/whatever to Python, at least the syntax. I find Python syntax very readable, it's the type system and semantics of Python that I dislike. Closest language to D with a Pythonesque syntax is Nimrod, nimrod-lang.org It's author, Araq, sometimes reads this forum. I believe that Haskell is the most popular statically typed language with indentation sensitive syntax. But Haskell is a lazy functional language where programming with side effects is more difficult. That's not like D. I doubt there's much interest in a new syntax for D. You may as well find or create a different language if it bothers you. I empathize, but I'm certain you'd be better off just getting used to the existing D syntax. |
March 21, 2014 Re: Improve D's syntax to make it more python like | ||||
---|---|---|---|---|
| ||||
Posted in reply to Pedro Larroy | Whether or not white space is significant is a _very_ subjective matter. It's not a given that it's a universal improvement. D is a C language family member and that's not going to change, including it's treatment of whitespace and use of braces.
On 3/21/14, 11:47 AM, Pedro Larroy wrote:
> Hi
>
> As a newcomer to D, I wonder, how difficult would be and would it be welcome by the D community to
> have D's syntax with significant whitespace and without brackets more like python?
>
>
> Thanks.
|
March 21, 2014 Re: Improve D's syntax to make it more python like | ||||
---|---|---|---|---|
| ||||
Posted in reply to Pedro Larroy | A Python syntax wrapper around D is a fun thing. It's also suggested as a fun project to work in the D Programming Language book by Andrei. [1] If you're coming to D from Python though, I suppose my suggestion would to try and get used to the C-like syntax. If C-like syntax is unusual for you, you'll get used to it eventually. It is nice sometimes in D to be able to use braces to declare an arbitrary scope and so on, and the braces tie in pretty well with closure syntax. You'll get used to it. [1] http://books.google.co.uk/books?id=bn7GNq6fiIUC&pg=PT47&dq=d+programming+language+python&hl=en&sa=X&ei=Eq4sU-rREOOt7QaTzoCQBg&redir_esc=y#v=onepage&q=d%20programming%20language%20python&f=false |
March 21, 2014 Re: Improve D's syntax to make it more python like | ||||
---|---|---|---|---|
| ||||
Posted in reply to Pedro Larroy | On Friday, March 21, 2014 18:47:47 Pedro Larroy wrote:
> Hi
>
> As a newcomer to D, I wonder, how difficult would be and would it be welcome by the D community to have D's syntax with significant whitespace and without brackets more like python?
*shudder* Python is more like the antithesis of good syntax IMHO. Sure, you could have a language with D's capabilities where the syntax had been adjusted to be more python-like, but I don't know what the benefit would be. Regardless, it's not like we're going to change D's syntax at this point. That would be king of breaking changes which wasn't worth what it cost.
I expect that the closest you would get would be some project which essentially created its own language and simply converted it to D when compiling.
- Jonathan M Davis
|
March 21, 2014 Re: Improve D's syntax to make it more python like | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile | On Friday, 21 March 2014 at 20:52:54 UTC, bearophile wrote:
> The Guest:
>
>> It's already in progress:
>> https://github.com/pplantinga/delight
>> http://pplantinga.github.io/
>
> Some design decision are bad, like "less" for "<", or the function definition syntax "function add(int a, b -> int):".
>
> Bye,
> bearophile
I agree with you. They should stick to PEP-3107 style "def add(a,
b: int) -> int:".
|
March 21, 2014 Re: Improve D's syntax to make it more python like | ||||
---|---|---|---|---|
| ||||
On Fri, Mar 21, 2014 at 05:47:03PM -0400, Jonathan M Davis wrote: > On Friday, March 21, 2014 18:47:47 Pedro Larroy wrote: > > Hi > > > > As a newcomer to D, I wonder, how difficult would be and would it be welcome by the D community to have D's syntax with significant whitespace and without brackets more like python? > > *shudder* Python is more like the antithesis of good syntax IMHO. Sure, you could have a language with D's capabilities where the syntax had been adjusted to be more python-like, but I don't know what the benefit would be. Regardless, it's not like we're going to change D's syntax at this point. That would be king of breaking changes which wasn't worth what it cost. > > I expect that the closest you would get would be some project which essentially created its own language and simply converted it to D when compiling. [...] I'm disappointed about how many discussions revolve around superficial things such as syntax, while neglecting weightier matters such as semantics and expressiveness. T -- What doesn't kill me makes me stranger. |
March 21, 2014 Re: Improve D's syntax to make it more python like | ||||
---|---|---|---|---|
| ||||
Posted in reply to Pedro Larroy Attachments:
| I don't know if significant whitespace is actually "improving" the syntax. "As a simple, self-contained example, consider the representation of program structure. Some observers objected to Go's C-like block structure with braces, preferring the use of spaces for indentation, in the style of Python or Haskell. However, we have had extensive experience tracking down build and test failures caused by cross-language builds where a Python snippet embedded in another language, for instance through a SWIG invocation, is subtly and invisibly broken by a change in the indentation of the surrounding code. Our position is therefore that, although spaces for indentation is nice for small programs, it doesn't scale well, and the bigger and more heterogeneous the code base, the more trouble it can cause. It is better to forgo convenience for safety and dependability, so Go has brace-bounded blocks. " Source: http://talks.golang.org/2012/splash.article -- Ziad |
March 21, 2014 Re: Improve D's syntax to make it more python like | ||||
---|---|---|---|---|
| ||||
Posted in reply to Russel Winder | On Friday, 21 March 2014 at 19:23:34 UTC, Russel Winder wrote: > On Fri, 2014-03-21 at 18:55 +0000, Frustrated wrote: > […] >> Why not just learn the correct syntax instead of perpetuating ignorance? Python syntax is not modern. COBOL just needs to go away... > > D syntax is of course less modern than that of Python: Python syntax is > 1980s, D syntax is rooted in C syntax which is 1970s. It is an error to > equate the quality of a programming language with the age of the base > syntax: D and Python are both good programming languages, different > agreed. > Um, ALGOL was created in the early 60's of which python's spacing scheme is based on. Just because python came out after C does not change that. Do you think it might have been possible that Ritchie learned the lessons of ALGOL of which Rossum spat in his face? Some people just never learn from history... "Python mandates a convention that programmers in ALGOL-style languages often follow." http://en.wikipedia.org/wiki/Python_syntax_and_semantics#Indentation |
Copyright © 1999-2021 by the D Language Foundation