Re: Improve D's syntax to make it more python like
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. As an alternative, python could be modified to make it more D like. Steve
Re: Improve D's syntax to make it more python like
On Tuesday, 25 March 2014 at 10:28:51 UTC, Nick Sabalausky wrote: So yea, the Haxe language itself wasn't really a key thing for me, just what it allowed me to *avoid* doing. But even those reasons are loosing their bite for me now, since Flash has pretty much become legacy, vibe.d has appeared, and I'd just as soon avoid the entire PHP runtime as a whole. I like the basic idea of Haxe since it in theory would allow programming cross platform on mobile units, but Apple, Google and Microsoft have made moves to make cross platform programming more difficult by deliberately being different for the sake of being different... Heh, I guess that's where we differ ;) I'm...not exactly a big Python fan, and I find D totally production-ready. Well, I wasn't a Python fan until I started using it, and still don't like the dynamic aspects of it, but the language/library support is better than the alternatives. The syntax does not prevent Python from scaling with a decent IDE, the lack of compile time type safety does. However it is nice to replace perl, bash, php etc with one cross platform language. Python manage to cover a lot of ground. That said I consider using D for a Windows tool (reading CVS files and uploading the result to a web server as a cron job). If I can do full static linking and just install a single binary then I can get simple unbreakable installs on client computers.
Re: Improve D's syntax to make it more python like
On Saturday, 22 March 2014 at 17:28:16 UTC, Andrei Alexandrescu wrote: As simple as it gets. The program would translate files with extension .wsd into files with extension .d and run dmd (or rdmd) transparently. Appropriate handling of file timestamps etc. would complete a nice utility. You'd use it like wsd myscript.wsd which under the hood would create (if necessary) myscript.d and then exec rdmd on it. Andrei Turns out this already exists: http://pplantinga.github.io/archives/delight-programming-language.html
Re: Improve D's syntax to make it more python like
On Friday, 21 March 2014 at 23:33:51 UTC, Ziad Hatahet wrote: 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 +1 This is exactly my experience. A lot of people use Python for quick prototyping which doesn't involve more than a few hundered lines of code. Fine. If, however, you have a medium-to-big project in Python it is just one big annoyance. Python's syntax is prescriptive in the sense that it prescribes how your code should look like on the page (to help you write clean code). Even trivial things like copy and paste cause problems in Python (not to mention the tab against space war). As usual, (over-)prescriptiveness causes more problems than it solves in the long run.
Re: Improve D's syntax to make it more python like
On 3/24/2014 6:49 PM, Ola Fosheim Grøstad ola.fosheim.grostad+dl...@gmail.com wrote: On Monday, 24 March 2014 at 22:23:50 UTC, Nick Sabalausky wrote: Using the same language on client/server is indeed quite nice, partly because of less mental context-switching, and also because of increased code sharing (which also makes it easier to move things between client vs server if you need to). Yes, especially for data models. It is always annoying to modify several different layers just to add some fields to a database entry. Not a big deal, but so… pointless. Yea, common data models was a very big use of shared server/client code for me, too. using Haxe pretty heavily for a good while. Haxe is a rather ok language, which is practically high praise coming from me - I'm typically very critical of languages. I've looked at Haxe from time to time, and I like the approach, but it has never been sufficient to solve any issues in any real code I've worked on. For me, the killer features were: - As mentioned already, shared server/client code. - Being able to run code on any commodity PHP servers I was required to support, without having to actually *write* any PHP. - (Note this was several years ago:) Being able to generate Flash applets without having to actually use any of Adobe's horrible toolchain. - The language itself *didn't* totally piss me off. ;) So yea, the Haxe language itself wasn't really a key thing for me, just what it allowed me to *avoid* doing. But even those reasons are loosing their bite for me now, since Flash has pretty much become legacy, vibe.d has appeared, and I'd just as soon avoid the entire PHP runtime as a whole. Yeah, that's where I am at now too. So currently I deal with Python, Dart (working hard to get rid of Javascript) and C++ (and dabble with XSLT, Java and Objective-C). But I'd rather use something more clean and strongly typed like Go and D, but with Pythonesque terseness and functional style list processing hight level cleaness. Unfortunately both D and Go lack production level support. And even with production level support they still lack production quality libraries for excel handling, pdf generation etc. Heh, I guess that's where we differ ;) I'm...not exactly a big Python fan, and I find D totally production-ready. I generally avoid client-side JS - when I do use it, it's just a sprinkling. If I need to do anything else Flash-like in the future, I'm looking more at Unity3D (esp. the v5 on the horizon with asm.js support) rather than doing HTML5 directly or via things like Dart or CoffeScript.
Re: Improve D's syntax to make it more python like
On Tuesday, 25 March 2014 at 10:28:51 UTC, Nick Sabalausky wrote: On 3/24/2014 6:49 PM, Ola Fosheim Grøstad ola.fosheim.grostad+dl...@gmail.com wrote: On Monday, 24 March 2014 at 22:23:50 UTC, Nick Sabalausky wrote: Using the same language on client/server is indeed quite nice, partly because of less mental context-switching, and also because of increased code sharing (which also makes it easier to move things between client vs server if you need to). Yes, especially for data models. It is always annoying to modify several different layers just to add some fields to a database entry. Not a big deal, but so… pointless. Yea, common data models was a very big use of shared server/client code for me, too. using Haxe pretty heavily for a good while. Haxe is a rather ok language, which is practically high praise coming from me - I'm typically very critical of languages. I've looked at Haxe from time to time, and I like the approach, but it has never been sufficient to solve any issues in any real code I've worked on. For me, the killer features were: - As mentioned already, shared server/client code. - Being able to run code on any commodity PHP servers I was required to support, without having to actually *write* any PHP. - (Note this was several years ago:) Being able to generate Flash applets without having to actually use any of Adobe's horrible toolchain. - The language itself *didn't* totally piss me off. ;) So yea, the Haxe language itself wasn't really a key thing for me, just what it allowed me to *avoid* doing. But even those reasons are loosing their bite for me now, since Flash has pretty much become legacy, vibe.d has appeared, and I'd just as soon avoid the entire PHP runtime as a whole. Yeah, that's where I am at now too. So currently I deal with Python, Dart (working hard to get rid of Javascript) and C++ (and dabble with XSLT, Java and Objective-C). But I'd rather use something more clean and strongly typed like Go and D, but with Pythonesque terseness and functional style list processing hight level cleaness. Unfortunately both D and Go lack production level support. And even with production level support they still lack production quality libraries for excel handling, pdf generation etc. Heh, I guess that's where we differ ;) I'm...not exactly a big Python fan, and I find D totally production-ready. I generally avoid client-side JS - when I do use it, it's just a sprinkling. If I need to do anything else Flash-like in the future, I'm looking more at Unity3D (esp. the v5 on the horizon with asm.js support) rather than doing HTML5 directly or via things like Dart or CoffeScript. In semi related news, have you guys seen Cmsed? Built into the data model registration is generation of javascript models which tie into the restful routing to give you (if I finished it) the same level of interaction with the database as you would in D. And yes you're in control of the security of each data model for each operation type. I just think thats a neat little feature.
Re: Improve D's syntax to make it more python like
I would appreciate being allowed to omit the trailing semicolon as in Scala, Go, Kotlin and some other newer languages. Not terribly important, but in most cases the end-of-line character is simply redundant.
Re: Improve D's syntax to make it more python like
On 3/22/2014 2:38 PM, Ola Fosheim Grøstad ola.fosheim.grostad+dl...@gmail.com wrote: On Saturday, 22 March 2014 at 17:54:16 UTC, Russel Winder wrote: like end to end the same language. Many are asking about server-side Dart as well as client-side Dart in the browser. Yes, a CLI/server Dart VM exists that is suitable for a http server. The advantage of client/server code sharing is obvious when you write web-apps, but I am a bit weary of using dynamic languages on web servers since runtime errors can be nasty. I personally would like to see a Dart version with a much stricter type system, but I think the Dart library is just about right for web development and the language itself is pretty well rounded and pragmatic (but nothing spectacular). Using the same language on client/server is indeed quite nice, partly because of less mental context-switching, and also because of increased code sharing (which also makes it easier to move things between client vs server if you need to). Because of that, and an irritating need to support cheapo shared/PHP-hosting servers (which are NEVER run by companies who have the slightest comprehension of security), I'd been using Haxe pretty heavily for a good while. Haxe is a rather ok language, which is practically high praise coming from me - I'm typically very critical of languages. FWIW though, lately I've been swinging back over to the side of I'd rather use the best language I can whenever possible, code duplication and other concerns over multiple languages be damnned. Life's too short to tolerate subpar tools.
Re: Improve D's syntax to make it more python like
On Monday, 24 March 2014 at 22:23:50 UTC, Nick Sabalausky wrote: Using the same language on client/server is indeed quite nice, partly because of less mental context-switching, and also because of increased code sharing (which also makes it easier to move things between client vs server if you need to). Yes, especially for data models. It is always annoying to modify several different layers just to add some fields to a database entry. Not a big deal, but so… pointless. using Haxe pretty heavily for a good while. Haxe is a rather ok language, which is practically high praise coming from me - I'm typically very critical of languages. I've looked at Haxe from time to time, and I like the approach, but it has never been sufficient to solve any issues in any real code I've worked on. FWIW though, lately I've been swinging back over to the side of I'd rather use the best language I can whenever possible, code duplication and other concerns over multiple languages be damnned. Life's too short to tolerate subpar tools. Yeah, that's where I am at now too. So currently I deal with Python, Dart (working hard to get rid of Javascript) and C++ (and dabble with XSLT, Java and Objective-C). But I'd rather use something more clean and strongly typed like Go and D, but with Pythonesque terseness and functional style list processing hight level cleaness. Unfortunately both D and Go lack production level support. And even with production level support they still lack production quality libraries for excel handling, pdf generation etc.
Re: Improve D's syntax to make it more python like
On 3/22/14, 12:43, Russel Winder wrote: On Sat, 2014-03-22 at 16:14 +, Brian Rogoff wrote: On Saturday, 22 March 2014 at 13:03:06 UTC, Russel Winder wrote: ALGOL60 did not have significant whitespace and an offside rule, just like C, C++ and D don't, whereas Python, OCaml, etc. do. I've programmed in OCaml for many years and I somehow missed the significant whitespace. Even the Revised syntax for OCaml (the improved and unused one) did not use significant whitespace, though I recall that there were unloved projects to provide such a syntax. I appear to have typed OCaml when I meant Haskell, possibly because I am trying to build Unison. You are correct (obviously :-) OCaml does not use an offside rule approach. In his response, Paulo points out that F# does, I did not appreciate this, so that is definitely a WILT. C++ has a much nastier syntax than D (IMO of course :-) but the SPECS proposal for a resyntaxed C++ never caught on. I liked some of the improvements suggested there, in particular the more Pascal-ish or Scala-ish declaration syntax, and would have liked something like that in D, but there are so many more issues to be fixed that daydreams of improved syntax seem frivolous to me. The Scala, Go, Rust, etc. use of type after variable name reads better for me, but C, C++, D, Java, Groovy, Ceylon are all type before variable (well the C++ rule is spiral out, but…), so I just get used to switching. I find I think of the type as an adjective, and since I'm only fluent in english it makes perfect sense that the adjective would come before the noun. What is X? X is an integer. Integer describes what X is. type after variable name just doesn't have that mental model to it, hence I like it less.
Re: Improve D's syntax to make it more python like
On 3/21/14, 20:47, Andrei Alexandrescu wrote: On 3/21/14, 5:18 PM, w0rp wrote: On Friday, 21 March 2014 at 21:52:47 UTC, H. S. Teoh wrote: I'm disappointed about how many discussions revolve around superficial things such as syntax, while neglecting weightier matters such as semantics and expressiveness. T http://www.haskell.org/haskellwiki/Wadler%27s_Law People love to debate syntax. Semantics are much more interesting and worth talking about. Well, one issue that's happening is that every so often github pull requests that are simple but important (such as documentation) sit there without getting due review. The regular contributors are spending time looking into them, with takes away time from more important issues they could work on. A dozen people are doing the simple work and the complicated work, while the rest of the forum sits on the sidelines wringing hands about what to do about the future of D. Andrei You really want me to contribute? Cause I will. And due to my lack of education on the matter I will get all up in your way. You want the community to help participate? Get a list of simple moderate and hard jobs that are relatively high priority, and update the list weekly. A stickied post on the announce forum would work. Cause if there's something simple I can do, I'll do it. I just don't know what I can do.
Re: Improve D's syntax to make it more python like
On 03/23/2014 02:01 PM, 1100110 wrote: ... I find I think of the type as an adjective, It's a noun. and since I'm only fluent in english it makes perfect sense that the adjective would come before the noun. What is X? X is an integer. ... Exactly.
Re: Improve D's syntax to make it more python like
On 3/22/14, 23:33, logicchains 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. It's interesting to see this being discussed, as somebody recently created a Go-like language with Pythonic syntax that compiles to Go. The Go community however didn't appear to be particularly interested in it: https://groups.google.com/forum/#!topic/golang-nuts/-STRYo2Cc0g ...And that is a perfect example of why I don't like Go. The Community seems overly hostile.
Re: Improve D's syntax to make it more python like
Am Sun, 23 Mar 2014 08:09:03 -0500 schrieb 1100110 0b1100...@gmail.com: A stickied post on the announce forum would work. ... stickied ... in a NNTP news group ... :) -- Marco
Re: Improve D's syntax to make it more python like
On 3/23/14, 8:23, Timon Gehr wrote: On 03/23/2014 02:01 PM, 1100110 wrote: ... I find I think of the type as an adjective, It's a noun. It's technically a metaphor =) and since I'm only fluent in english it makes perfect sense that the adjective would come before the noun. What is X? X is an integer. ... Exactly.
Re: Improve D's syntax to make it more python like
On 3/23/2014 9:01 AM, 1100110 wrote: I find I think of the type as an adjective, and since I'm only fluent in english it makes perfect sense that the adjective would come before the noun. What is X? X is an integer. Integer describes what X is. type after variable name just doesn't have that mental model to it, hence I like it less. I like type name; order because I usually know the type I want (even if it's just auto) before I know what I want to name the variable. So it's more natural for me to write. I've done plenty of name : type; code before, and I'm fine with it, but I usually end up either writing the type first and then moving back to write the name, or come up with a name first while making sure not to forget what type I'd already had in mind. So a little bit more awkward for me.
Re: Improve D's syntax to make it more python like
On 3/23/14, 9:36, Marco Leise wrote: Am Sun, 23 Mar 2014 08:09:03 -0500 schrieb 1100110 0b1100...@gmail.com: A stickied post on the announce forum would work. stickied ... in a NNTP news group ... :) Haha, I just meant bump it so that it stays active. There's a reason I used quotes! =P
Re: Improve D's syntax to make it more python like
On Saturday, 22 March 2014 at 01:47:48 UTC, Andrei Alexandrescu wrote: On 3/21/14, 5:18 PM, w0rp wrote: A dozen people are doing the simple work and the complicated work, while the rest of the forum sits on the sidelines wringing hands about what to do about the future of D. Andrei, Is there a list of grunt jobs that need to be done? Steve
Re: Improve D's syntax to make it more python like
On Fri, 2014-03-21 at 18:21 -0700, Andrei Alexandrescu wrote: […] I think some (including possibly myself) could enjoy a D dialect with Python indentation quite a bit. Given D's compilation speed, that can be achieved as a dialect without much aggravation by using a preprocessor. In fact I considered writing such a preprocessor as a running example through the chapters of TDPL, but didn't get around to it. I am not convinced. CoffeeScript as a JavaScript dialect hasn't really taken off, people just use JavaScript. Interestingly a similar thought is on a thread in the Go community: provide a nicer syntax to Go. -- Russel. = Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.win...@ekiga.net 41 Buckmaster Roadm: +44 7770 465 077 xmpp: rus...@winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
Re: Improve D's syntax to make it more python like
On Saturday, 22 March 2014 at 12:36:17 UTC, Russel Winder wrote: I am not convinced. CoffeeScript as a JavaScript dialect hasn't really taken off, people just use JavaScript. Well, that depends on your definition of taken off. If you were to do a GitHub search, you'd probably find a lot more projects using CoffeeScript than e.g. D. Also, CoffeeScript compiles to JavaScript, so it isn't even an either-or question in first place. David
Re: Improve D's syntax to make it more python like
On Fri, 2014-03-21 at 23:47 +, Frustrated wrote: […] 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 ALGOL60 had begin and end to delimit blocks, the indentation of the block was a visual thing to help readability, just as in C, C++, D. ALGOL60 did not have significant whitespace and an offside rule, just like C, C++ and D don't, whereas Python, OCaml, etc. do. -- Russel. = Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.win...@ekiga.net 41 Buckmaster Roadm: +44 7770 465 077 xmpp: rus...@winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
Re: Improve D's syntax to make it more python like
On Saturday, 22 March 2014 at 12:36:17 UTC, Russel Winder wrote: I am not convinced. CoffeeScript as a JavaScript dialect hasn't really taken off, people just use JavaScript. Well, I don't know, Dart is in the same vein as CoffeeScript. Dart is compiling to Javascript and Angular Dart is gaining quite a bit of interest even before being ready for production. AngularJS is already quite popular, and more messy than the Dart version. There is a clear upgrade path from JS-Dart. Dart VM will most likely be integrated in Chrome by the end of the year and that probably will have an effect on adoption rate. But, the Dart semantics are significantly better than ECMAScript/Javascript. Probably more so than CoffeeScript. cfront also used to compile to C, but the C++ semantics are more suitable for OO than C. So it supports a different workflow. (but cfront as I remember it was nowhere near great) So, in one aspect I agree, if the dialect is just syntax, then it has less chance of gaining momentum, but if it better supports a particular workflow/ type of modelling then it might succeed. I think a python-like syntax in combination with an interpreter like environment (in the vain of ipython) could be more suitable for a particular workflow than the c-like syntax. A strongly typed, terse and readable language with a good dev environment could be a real killer. Prototype in the REPL/interpreter and paste into your editor is an attractive development proposition.
Re: Improve D's syntax to make it more python like
On 3/22/14, 1:22 AM, Steve Teale wrote: On Saturday, 22 March 2014 at 01:47:48 UTC, Andrei Alexandrescu wrote: On 3/21/14, 5:18 PM, w0rp wrote: A dozen people are doing the simple work and the complicated work, while the rest of the forum sits on the sidelines wringing hands about what to do about the future of D. Andrei, Is there a list of grunt jobs that need to be done? Steve Maintaining a list would be as much overhead as fixing the items on it. Just pick from: https://github.com/D-Programming-Language/dlang.org/pulls https://github.com/D-Programming-Language/tools/pulls https://github.com/D-Programming-Language/installer/pulls https://github.com/D-Programming-Language/dconf.org/pulls https://github.com/D-Programming-Language/visuald/pulls https://github.com/D-Programming-Language/phobos/pulls https://github.com/D-Programming-Language/druntime/pulls https://github.com/D-Programming-Language/dmd/pulls Andrei
Re: Improve D's syntax to make it more python like
On Saturday, 22 March 2014 at 13:03:06 UTC, Russel Winder wrote: ALGOL60 did not have significant whitespace and an offside rule, just like C, C++ and D don't, whereas Python, OCaml, etc. do. I've programmed in OCaml for many years and I somehow missed the significant whitespace. Even the Revised syntax for OCaml (the improved and unused one) did not use significant whitespace, though I recall that there were unloved projects to provide such a syntax. C++ has a much nastier syntax than D (IMO of course :-) but the SPECS proposal for a resyntaxed C++ never caught on. I liked some of the improvements suggested there, in particular the more Pascal-ish or Scala-ish declaration syntax, and would have liked something like that in D, but there are so many more issues to be fixed that daydreams of improved syntax seem frivolous to me.
Re: Improve D's syntax to make it more python like
On Saturday, 22 March 2014 at 01:22:14 UTC, Andrei Alexandrescu wrote: ...Given D's compilation speed, that can be achieved as a dialect without much aggravation by using a preprocessor. In fact I considered writing such a preprocessor as a running example... Please someone could show a little example of the quote above? I mean it would act like C preprocessor or in D it has another meaning? Thanks, Matheus.
Re: Improve D's syntax to make it more python like
Am 22.03.2014 17:14, schrieb Brian Rogoff: On Saturday, 22 March 2014 at 13:03:06 UTC, Russel Winder wrote: ALGOL60 did not have significant whitespace and an offside rule, just like C, C++ and D don't, whereas Python, OCaml, etc. do. I've programmed in OCaml for many years and I somehow missed the significant whitespace. Even the Revised syntax for OCaml (the improved and unused one) did not use significant whitespace, though I recall that there were unloved projects to provide such a syntax. When F# was still in beta, it had OCaml syntax as default with a significant whitespace mode that could be turned on with a compiler directive #light on. While asking the embryonic F# community which mode should be the default. The significant whitespace mode won and became the default, with the OCaml mode being the optional one. -- Paulo
Re: Improve D's syntax to make it more python like
On Saturday, 22 March 2014 at 16:19:44 UTC, MattCoder wrote: Please someone could show a little example of the quote above? I mean it would act like C preprocessor or in D it has another meaning? You would write a little program that sees changes of indentation and puts the braces in. So foo bar baz whatever It would see that bar and baz are indented together and put {} around it, making: foo { bar baz } whatever or something like that, which can then be fed into the D compiler normally.
Re: Improve D's syntax to make it more python like
On 3/22/14, 9:19 AM, MattCoder wrote: On Saturday, 22 March 2014 at 01:22:14 UTC, Andrei Alexandrescu wrote: ...Given D's compilation speed, that can be achieved as a dialect without much aggravation by using a preprocessor. In fact I considered writing such a preprocessor as a running example... Please someone could show a little example of the quote above? I mean it would act like C preprocessor or in D it has another meaning? As simple as it gets. The program would translate files with extension .wsd into files with extension .d and run dmd (or rdmd) transparently. Appropriate handling of file timestamps etc. would complete a nice utility. You'd use it like wsd myscript.wsd which under the hood would create (if necessary) myscript.d and then exec rdmd on it. Andrei
Re: Improve D's syntax to make it more python like
On Sat, 2014-03-22 at 16:14 +, Brian Rogoff wrote: On Saturday, 22 March 2014 at 13:03:06 UTC, Russel Winder wrote: ALGOL60 did not have significant whitespace and an offside rule, just like C, C++ and D don't, whereas Python, OCaml, etc. do. I've programmed in OCaml for many years and I somehow missed the significant whitespace. Even the Revised syntax for OCaml (the improved and unused one) did not use significant whitespace, though I recall that there were unloved projects to provide such a syntax. I appear to have typed OCaml when I meant Haskell, possibly because I am trying to build Unison. You are correct (obviously :-) OCaml does not use an offside rule approach. In his response, Paulo points out that F# does, I did not appreciate this, so that is definitely a WILT. C++ has a much nastier syntax than D (IMO of course :-) but the SPECS proposal for a resyntaxed C++ never caught on. I liked some of the improvements suggested there, in particular the more Pascal-ish or Scala-ish declaration syntax, and would have liked something like that in D, but there are so many more issues to be fixed that daydreams of improved syntax seem frivolous to me. The Scala, Go, Rust, etc. use of type after variable name reads better for me, but C, C++, D, Java, Groovy, Ceylon are all type before variable (well the C++ rule is spiral out, but…), so I just get used to switching. -- Russel. = Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.win...@ekiga.net 41 Buckmaster Roadm: +44 7770 465 077 xmpp: rus...@winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
Re: Improve D's syntax to make it more python like
On 3/21/2014 7:08 PM, H. S. Teoh wrote: Perhaps we should be talking about how more people can make github contributions instead. ;-) Anyone can create a bugzilla account and/or a github account and get started contributing. Nobody's permission is required.
Re: Improve D's syntax to make it more python like
On Sat, 2014-03-22 at 15:10 +, Ola Fosheim =?UTF-8?B?R3LDuHN0YWQi?= @puremagic.com wrote: […] Well, I don't know, Dart is in the same vein as CoffeeScript. Dart is compiling to Javascript and Angular Dart is gaining quite a bit of interest even before being ready for production. AngularJS is already quite popular, and more messy than the Dart version. There is a clear upgrade path from JS-Dart. Dart VM will most likely be integrated in Chrome by the end of the year and that probably will have an effect on adoption rate. But, the Dart semantics are significantly better than ECMAScript/Javascript. Probably more so than CoffeeScript. […] I am currently ambivalent about Dart. Node.js has shown that many people like end to end the same language. Many are asking about server-side Dart as well as client-side Dart in the browser. Another player in this game is Ceylon which has the explicit aim of being the end to end language compiling to JVM or JavaScript for server side and JavaScript for client side. I'm not sure how they play the HTML5 (AngularJS, Ember.js, Backbone.js, jQuery, etc) game. But I have stopped following all that recently for various reasons. I think a python-like syntax in combination with an interpreter like environment (in the vain of ipython) could be more suitable for a particular workflow than the c-like syntax. A strongly typed, terse and readable language with a good dev environment could be a real killer. Prototype in the REPL/interpreter and paste into your editor is an attractive development proposition. IPython is an excellent tool for creating documents that incorporate executable Python as an integral component. It is literate Python programming. However it is only a good tool if the end result is a document to be read and shared. I think the Python IDE such as Wing IDE, PyCharm, actually do the REPL and editor model better. But as the saying goes YMMV. -- Russel. = Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.win...@ekiga.net 41 Buckmaster Roadm: +44 7770 465 077 xmpp: rus...@winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
Re: Improve D's syntax to make it more python like
On Sat, Mar 22, 2014 at 10:48:44AM -0700, Walter Bright wrote: On 3/21/2014 7:08 PM, H. S. Teoh wrote: Perhaps we should be talking about how more people can make github contributions instead. ;-) Anyone can create a bugzilla account and/or a github account and get started contributing. Nobody's permission is required. I know that. :) I was alluding to motivating more forumites to participate. T -- Без труда не выловишь и рыбку из пруда.
Re: Improve D's syntax to make it more python like
On 03/22/14 11:14, Brian Rogoff wrote: [snip] C++ has a much nastier syntax than D (IMO of course :-) but the SPECS proposal for a resyntaxed C++ never caught on. Brian, could you provide a link for this proposal? I'd appreciate it. -regards, Larry
Re: Improve D's syntax to make it more python like
On 21 March 2014 18:55, Frustrated frustra...@nowhere.com 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. Why not just learn the correct syntax instead of perpetuating ignorance? Python syntax is not modern. COBOL just needs to go away... http://www.coboloncogs.org/INDEX.HTM
Re: Improve D's syntax to make it more python like
On Saturday, 22 March 2014 at 18:08:01 UTC, evansl wrote: On 03/22/14 11:14, Brian Rogoff wrote: [snip] C++ has a much nastier syntax than D (IMO of course :-) but the SPECS proposal for a resyntaxed C++ never caught on. Brian, could you provide a link for this proposal? I'd appreciate it. -regards, Larry http://www.csse.monash.edu.au/~damian/papers/HTML/ModestProposal.html I think there is an expanded version of this report too, but this gives you the flavor. Note that it is based on a fairly old version of C++. I prefer the D !() for templates to their [], but I prefer their declaration and pointer syntax. I don't think D's current syntax is really a problem. Well, there are some things that vex me a bit, like the multiple alias this and also the is syntax. Even though I prefer indentation sensitive syntax to C style syntax, if there were a front end for D that used an alternative syntax I would not use it. I suspect that I'm hardly unique in that either.
Re: Improve D's syntax to make it more python like
On Saturday, 22 March 2014 at 17:54:16 UTC, Russel Winder wrote: like end to end the same language. Many are asking about server-side Dart as well as client-side Dart in the browser. Yes, a CLI/server Dart VM exists that is suitable for a http server. The advantage of client/server code sharing is obvious when you write web-apps, but I am a bit weary of using dynamic languages on web servers since runtime errors can be nasty. I personally would like to see a Dart version with a much stricter type system, but I think the Dart library is just about right for web development and the language itself is pretty well rounded and pragmatic (but nothing spectacular). IPython is an excellent tool for creating documents that incorporate executable Python as an integral component. It is literate Python programming. However it is only a good tool if the end result is a document to be read and shared. Hm, I use it for all kinds of small scale experiments/testing, which usually just involves getting those 1-4 lines of python code right (array transformations, regexps etc). I guess it depends on what you use Python for. I think the Python IDE such as Wing IDE, PyCharm, actually do the REPL and editor model better. They probably are, but my point was more that a REPL/interpreter friendly syntax is not the same as a write/compile friendly syntax. (I am currently using Eclipse with PyDev and am a bit reluctant to use even more IDEs, but I see that PyCharm has a new free edition that I probably should check out. Thanks for the tip!) Ola.
Re: Improve D's syntax to make it more python like
On Saturday, 22 March 2014 at 16:28:11 UTC, Paulo Pinto wrote: When F# was still in beta, it had OCaml syntax as default with a significant whitespace mode that could be turned on with a compiler directive #light on. While asking the embryonic F# community which mode should be the default. The significant whitespace mode won and became the default, with the OCaml mode being the optional one. That's not too hard to believe. I like OCaml a lot but its syntax is not its best feature. The OCaml preprocessor (CamlP4) had an improved syntax called Revised as one of its applications. As I recall, Gerard Huet (who publicized 'the zipper') used a subset of Revised he called Pidgin ML in his publications. They looked a lot nicer than regular OCaml. I've never written any F#, since I live in the world of Unix, and never visit Windows. It looks like it has some interesting improvements over OCaml (let!, async stuff, LINQ, some overloading, ...) but has a weak module system compared to OCaml.
Re: Improve D's syntax to make it more python like
Brian Rogoff: I like OCaml a lot but its syntax is not its best feature. See also: http://people.csail.mit.edu/mikelin/ocaml+twt/ Bye, bearophile
Re: Improve D's syntax to make it more python like
On Saturday, 22 March 2014 at 17:28:16 UTC, Andrei Alexandrescu wrote: On 3/22/14, 9:19 AM, MattCoder wrote: On Saturday, 22 March 2014 at 01:22:14 UTC, Andrei Alexandrescu wrote: ...Given D's compilation speed, that can be achieved as a dialect without much aggravation by using a preprocessor. In fact I considered writing such a preprocessor as a running example... Please someone could show a little example of the quote above? I mean it would act like C preprocessor or in D it has another meaning? As simple as it gets. The program would translate files with extension .wsd into files with extension .d and run dmd (or rdmd) transparently. Appropriate handling of file timestamps etc. would complete a nice utility. You'd use it like wsd myscript.wsd which under the hood would create (if necessary) myscript.d and then exec rdmd on it. Andrei After far too many hours on a plane today, I ended up building this[1]. This is very much a proof of concept, and not production ready in the slightest. I should point out that the extensibility and maintainability of this is roughly equivalent to that of a potato, but it serves its purpose decently well. [1] https://github.com/ColdenCullen/wsd
Re: Improve D's syntax to make it more python like
Colden Cullen: [1] https://github.com/ColdenCullen/wsd Looks like a good start. I could even use that syntax in some cases :-) (like some script-like programs). Using just an indent to define a sub-block seems a little too much brittle. So perhaps a specific keyword or symbol could be be used. In Python there is also the keyword pass that could be useful here. It could also be useful some way to switch back to normal D syntax inside a file, to solve some problem (like to simplify mixins creation). Bye, bearophile
Re: Improve D's syntax to make it more python like
On 03/21/2014 07:47 PM, 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. http://delight.sourceforge.net/
Re: Improve D's syntax to make it more python like
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. Why not just learn the correct syntax instead of perpetuating ignorance? Python syntax is not modern. COBOL just needs to go away...
Re: Improve D's syntax to make it more python like
Pedro Larroy: 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? You have to revive this project to port it to D2: http://delight.sourceforge.net/ Bye, bearophile
Re: Improve D's syntax to make it more python like
On Friday, 21 March 2014 at 18:47:49 UTC, Pedro Larroy wrote: 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? I don't think it would be really hard to do in the compiler, you could probably make it work by hacking up the lexer. But I'm totally against it, Python has hideous syntax.
Re: Improve D's syntax to make it more python like
On Fri, 2014-03-21 at 18:55 +, 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. -- Russel. = Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.win...@ekiga.net 41 Buckmaster Roadm: +44 7770 465 077 xmpp: rus...@winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
Re: Improve D's syntax to make it more python like
On Fri, 2014-03-21 at 19:13 +, Adam D. Ruppe wrote: […] But I'm totally against it, Python has hideous syntax. I would leave D syntax as it is. Python syntax is not hideous, it is good; very Pythonic, unlike D. -- Russel. = Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.win...@ekiga.net 41 Buckmaster Roadm: +44 7770 465 077 xmpp: rus...@winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
Re: Improve D's syntax to make it more python like
On Friday, 21 March 2014 at 18:51:46 UTC, bearophile wrote: Pedro Larroy: 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? You have to revive this project to port it to D2: http://delight.sourceforge.net/ Bye, bearophile It's already in progress: https://github.com/pplantinga/delight http://pplantinga.github.io/
Re: Improve D's syntax to make it more python like
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. I don't think it's so difficult but it will increase a lot of code. Also, I don't believe the community will like something this. I'm not sure how accepted is python to most of this C/C++ guys. I personally don't like python/ruby/perl syntax.
Re: Improve D's syntax to make it more python like
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.
Re: Improve D's syntax to make it more python like
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
Re: Improve D's syntax to make it more python like
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
Re: Improve D's syntax to make it more python like
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.
Re: Improve D's syntax to make it more python like
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.
Re: Improve D's syntax to make it more python like
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=bn7GNq6fiIUCpg=PT47dq=d+programming+language+pythonhl=ensa=Xei=Eq4sU-rREOOt7QaTzoCQBgredir_esc=y#v=onepageq=d%20programming%20language%20pythonf=false
Re: Improve D's syntax to make it more python like
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
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.
Re: Improve D's syntax to make it more python like
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:.
Re: Improve D's syntax to make it more python like
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
Re: Improve D's syntax to make it more python like
On Friday, 21 March 2014 at 19:23:34 UTC, Russel Winder wrote: On Fri, 2014-03-21 at 18:55 +, 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
Re: Improve D's syntax to make it more python like
On Friday, March 21, 2014 14:51:13 H. S. Teoh wrote: I'm disappointed about how many discussions revolve around superficial things such as syntax, while neglecting weightier matters such as semantics and expressiveness. I suspect that a lot of it just comes down to bikeshedding. Syntax is something that pretty much everyone can discuss, whereas semantics get a lot more complicated and require a much greater understanding. - Jonathan M Davis
Re: Improve D's syntax to make it more python like
On Friday, 21 March 2014 at 21:52:47 UTC, H. S. Teoh wrote: I'm disappointed about how many discussions revolve around superficial things such as syntax, while neglecting weightier matters such as semantics and expressiveness. T http://www.haskell.org/haskellwiki/Wadler%27s_Law People love to debate syntax. Semantics are much more interesting and worth talking about.
Re: Improve D's syntax to make it more python like
On 03/22/2014 12:47 AM, Frustrated wrote: 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. =D. http://en.wikipedia.org/wiki/ALGOL#Examples_and_portability_issues 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? No way. 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 Yup. ALGOL-style languages such as D.
Re: Improve D's syntax to make it more python like
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? Hey Pedro, I think some (including possibly myself) could enjoy a D dialect with Python indentation quite a bit. Given D's compilation speed, that can be achieved as a dialect without much aggravation by using a preprocessor. In fact I considered writing such a preprocessor as a running example through the chapters of TDPL, but didn't get around to it. Andrei
Re: Improve D's syntax to make it more python like
On 3/21/14, 5:18 PM, w0rp wrote: On Friday, 21 March 2014 at 21:52:47 UTC, H. S. Teoh wrote: I'm disappointed about how many discussions revolve around superficial things such as syntax, while neglecting weightier matters such as semantics and expressiveness. T http://www.haskell.org/haskellwiki/Wadler%27s_Law People love to debate syntax. Semantics are much more interesting and worth talking about. Well, one issue that's happening is that every so often github pull requests that are simple but important (such as documentation) sit there without getting due review. The regular contributors are spending time looking into them, with takes away time from more important issues they could work on. A dozen people are doing the simple work and the complicated work, while the rest of the forum sits on the sidelines wringing hands about what to do about the future of D. Andrei
Re: Improve D's syntax to make it more python like
On Fri, Mar 21, 2014 at 06:47:28PM -0700, Andrei Alexandrescu wrote: On 3/21/14, 5:18 PM, w0rp wrote: On Friday, 21 March 2014 at 21:52:47 UTC, H. S. Teoh wrote: I'm disappointed about how many discussions revolve around superficial things such as syntax, while neglecting weightier matters such as semantics and expressiveness. T http://www.haskell.org/haskellwiki/Wadler%27s_Law People love to debate syntax. Semantics are much more interesting and worth talking about. Well, one issue that's happening is that every so often github pull requests that are simple but important (such as documentation) sit there without getting due review. The regular contributors are spending time looking into them, with takes away time from more important issues they could work on. A dozen people are doing the simple work and the complicated work, while the rest of the forum sits on the sidelines wringing hands about what to do about the future of D. [...] Perhaps we should be talking about how more people can make github contributions instead. ;-) T -- Why are you blatanly misspelling blatant? -- Branden Robinson