digitalmars.D - Dart and D: features that could be used in D,
- Timothee Cour (68/68) Feb 27 2014 A1)
- Suliman (3/3) Feb 27 2014 What needed to create language that can be run everywhere? I mean
- bearophile (7/31) Feb 27 2014 A variant of this idea was discussed, and I think it's a good
- w0rp (3/3) Feb 27 2014 I don't like any of the syntax changes mentioned. I do like the
- Asman01 (5/96) Feb 27 2014 I've hear that Microsoft's equivalent so-called TypeScript was
- Ary Borenszweig (4/6) Feb 27 2014 In a programming language you can make everything look like an object
- Paulo Pinto (3/10) Feb 27 2014 Yep, that is how for example .NET, Eiffel, Smalltalk, Lisp and many
- Bienlein (4/6) Feb 28 2014 An object in Smalltalk is not a primitive type. Even ints,
- Paulo Pinto (7/13) Feb 28 2014 Yes they are, kind of, because the ones small enough to fit in
- thedeemon (14/26) Feb 27 2014 No, neither Chromium nor even Chrome run it natively. Only
- Paulo Pinto (12/19) Feb 27 2014 From what I understood on Dart talks last Google IO, work was planned
- Craig Dillabaugh (11/12) Feb 27 2014 Really? I've been stuck for the past week or so trying to put
- w0rp (5/20) Feb 27 2014 I developed 99% of the JavaScript part of an application for a
- Craig Dillabaugh (3/26) Feb 27 2014 Great. Now I have something to go an read for laughs whenever I
- Martin Drasar (5/8) Feb 27 2014 I think it was someone on Slashdot who posted this wonderful comment:
- Chris (24/47) Feb 28 2014 @Craig&w0rp
- Chris (5/55) Feb 28 2014 "There is another option here. Use another programming language."
- bearophile (10/12) Feb 28 2014 Probably that's part of the problem. More experience in a
- Chris (15/27) Feb 28 2014 Unfortunately, you cannot get experienced in JS, there's always a
- Chris (5/11) Feb 28 2014 Ah, no, it's MS. So is Silverlight. Don't like proprietary stuff.
- Asman01 (5/17) Mar 01 2014 And now with full(native, i.e., not using a plug-in) support in
- Craig Dillabaugh (3/24) Mar 01 2014 As soon as Microsoft releases a Linux version I will be sure to
- Asman01 (2/28) Mar 01 2014 Well, you will need to wait a while. :P
- Paulo Pinto (17/31) Feb 27 2014 I didn't say I like it that much, just that it is good enough for what
- Russel Winder (18/29) Feb 27 2014 Dartium is a build of Chromium with both, so this is very much the
- Walter Bright (3/4) Feb 27 2014 This comes up now and then. The problem with it is it makes function ove...
- Jacob Carlborg (6/8) Mar 01 2014 We could quite easy add support for named parameters but still require
- bearophile (10/14) Mar 01 2014 I think requiring the same position of the arguments goes against
- Michel Fortin (14/22) Mar 01 2014 I did implement something like that in DMD a while ago as an
- Jacob Carlborg (6/14) Mar 01 2014 That happens too often :(
- Walter Bright (6/8) Feb 27 2014 As a general rule, negation features are frequently misunderstood, our b...
- Walter Bright (13/41) Feb 27 2014 D doesn't allow non-trivial default struct constructors for some good re...
- bearophile (16/40) Feb 27 2014 The idea of having some syntax like this is nice, it reduces the
- Timothee Cour (6/13) Feb 27 2014 Not sure what the problem would be. We could apply the same rules as for
- Adam D. Ruppe (6/6) Feb 27 2014 We could kinda do named parameters today like this:
- Timothee Cour (13/23) Feb 27 2014 cascade != chaining:
- Timothee Cour (3/14) Feb 27 2014 http://wiki.dlang.org/DIP45
- Timothee Cour (15/33) Feb 27 2014 I don't recall this syntax 'Point(this.z, this.x){...}' ever being
A1) Google's Dart (https://www.dartlang.org) looks like a very promising replacement for javascript. It can compile to javascript to ensure portability (but chromium runs it natively) but the language itself reminds more of D to a surprising extent. Dart language has features such as: static typing (but can also have dynamic typing, akin to std.variant, with better support/syntax than D) ahead of time compilation unicode support built in serialization/deserialization via json annotations mixins (used to emulate multiple inheritance) generics vector/AA litterals alias (called typedef in dart), is, assert try/catch/finally operator overloading properties (same parenthesis-less caller syntax as in D) delegates (called closures) nesting functions, 1st class functions, lambda => syntax DDOC (called dartdoc) D-like syntax and nesting comments, introspection (runtime only AFAIK) A2) Also features that would be nice to have in D or were better designed than in D: * cascade operations: they perform a series of operations on the members of a single object: foo.bar(1)..baz(3) equivalent to: foo.bar(1) foo.baz(3) * better way to define default constructors: class Point { num x; num y; num z; // Syntactic sugar for setting z and x before the constructor body runs. Point(this.z, this.x){...} } This is more explicit and flexible than D's way for default struct constructors, which can only allow to set all fields in order, without skipping some, and doesn't allow to do anything else in the ctor. * named constructors * distinguish integer divide (~/) vs divide (/), so that 5/2=2, 5~/2=2 * shorthand function declaration with => (used not just for lambdas) * for (var x in collection) //better syntax than foreach(var;collection) * better syntax for optional positional arguments: void fun(int x, [int y, int z=3]){...} Thinking of which, this would actually solve a long standing problem in D, that of specifying optional parameters AFTER a variadic template: void fun(T...)(T args, [string file=__FILE__,int line=__LINE__]){...} * export for libraries * async/wait etc * great IDE/debugger/package manager/static analyzer also the following which I've previously proposed adding to D: * string interpolation $variableName (or ${expression}) assert('foo. ${s.toUpperCase()} bar' == 'foo. STRING INTERPOLATION bar'); * optional named parameters arguments (with simplest possible syntax) * import all except specified symbols: import 'package:lib2/lib2.dart' hide foo; // Import all names EXCEPT foo. A3) And then some design decisions which wouldn't work for D: everything is an object, no struct (just class), VM, etc. A4) there were may previous threads regarding using D on the web via compiling to javascript. In light of this it would seem a lot easier to compile D to dart.
Feb 27 2014
What needed to create language that can be run everywhere? I mean would it be hard to add support of running D code in web-browser? it's better to write all logic at one language, that on 2 or 3.
Feb 27 2014
Timothee Cour:* better way to define default constructors: class Point { num x; num y; num z; // Syntactic sugar for setting z and x before the constructor body runs. Point(this.z, this.x){...} } This is more explicit and flexible than D's way for default struct constructors, which can only allow to set all fields in order, without skipping some, and doesn't allow to do anything else in the ctor.A variant of this idea was discussed, and I think it's a good idea.* distinguish integer divide (~/) vs divide (/), so that 5/2=2, 5~/2=2 * shorthand function declaration with => (used not just for lambdas)Both good. But for the first you need a different syntax in D.* optional named parameters arguments (with simplest possible syntax) * import all except specified symbols: import 'package:lib2/lib2.dart' hide foo; // Import all names EXCEPT foo.Probably both good, if well designed. Bye, bearophile
Feb 27 2014
I don't like any of the syntax changes mentioned. I do like the suggestions for better IDEs and similar tools. We can always do more to improve these.
Feb 27 2014
On Thursday, 27 February 2014 at 10:27:41 UTC, Timothee Cour wrote:A1) Google's Dart (https://www.dartlang.org) looks like a very promising replacement for javascript. It can compile to javascript to ensure portability (but chromium runs it natively) but the language itself reminds more of D to a surprising extent. Dart language has features such as: static typing (but can also have dynamic typing, akin to std.variant, with better support/syntax than D) ahead of time compilation unicode support built in serialization/deserialization via json annotations mixins (used to emulate multiple inheritance) generics vector/AA litterals alias (called typedef in dart), is, assert try/catch/finally operator overloading properties (same parenthesis-less caller syntax as in D) delegates (called closures) nesting functions, 1st class functions, lambda => syntax DDOC (called dartdoc) D-like syntax and nesting comments, introspection (runtime only AFAIK) A2) Also features that would be nice to have in D or were better designed than in D: * cascade operations: they perform a series of operations on the members of a single object: foo.bar(1)..baz(3) equivalent to: foo.bar(1) foo.baz(3) * better way to define default constructors: class Point { num x; num y; num z; // Syntactic sugar for setting z and x before the constructor body runs. Point(this.z, this.x){...} } This is more explicit and flexible than D's way for default struct constructors, which can only allow to set all fields in order, without skipping some, and doesn't allow to do anything else in the ctor. * named constructors * distinguish integer divide (~/) vs divide (/), so that 5/2=2, 5~/2=2 * shorthand function declaration with => (used not just for lambdas) * for (var x in collection) //better syntax than foreach(var;collection) * better syntax for optional positional arguments: void fun(int x, [int y, int z=3]){...} Thinking of which, this would actually solve a long standing problem in D, that of specifying optional parameters AFTER a variadic template: void fun(T...)(T args, [string file=__FILE__,int line=__LINE__]){...} * export for libraries * async/wait etc * great IDE/debugger/package manager/static analyzer also the following which I've previously proposed adding to D: * string interpolation $variableName (or ${expression}) assert('foo. ${s.toUpperCase()} bar' == 'foo. STRING INTERPOLATION bar'); * optional named parameters arguments (with simplest possible syntax) * import all except specified symbols: import 'package:lib2/lib2.dart' hide foo; // Import all names EXCEPT foo. A3) And then some design decisions which wouldn't work for D: everything is an object, no struct (just class), VM, etc. A4) there were may previous threads regarding using D on the web via compiling to javascript. In light of this it would seem a lot easier to compile D to dart.I've hear that Microsoft's equivalent so-called TypeScript was more successfully than Google's one, more people like much more TypeScript syntax and features, like I do.
Feb 27 2014
On 2/27/14, 7:19 AM, Timothee Cour wrote:And then some design decisions which wouldn't work for D: everything is an object, no struct (just class), VM, etc.In a programming language you can make everything look like an object but implement it as a primitive type. So that could work in D (but I think nobody would like it, although it can make the language much simpler).
Feb 27 2014
Am 27.02.2014 17:48, schrieb Ary Borenszweig:On 2/27/14, 7:19 AM, Timothee Cour wrote:Yep, that is how for example .NET, Eiffel, Smalltalk, Lisp and many other languages work.And then some design decisions which wouldn't work for D: everything is an object, no struct (just class), VM, etc.In a programming language you can make everything look like an object but implement it as a primitive type. So that could work in D (but I think nobody would like it, although it can make the language much simpler).
Feb 27 2014
On Thursday, 27 February 2014 at 17:16:54 UTC, Paulo Pinto wrote:Yep, that is how for example .NET, Eiffel, Smalltalk, Lisp and many other languages work.An object in Smalltalk is not a primitive type. Even ints, floats, chars, etc. in Smalltalk are no primitive types but objects. Not wanting to be a rogue. Just pointing out ;-).
Feb 28 2014
Am 28.02.2014 13:15, schrieb Bienlein:On Thursday, 27 February 2014 at 17:16:54 UTC, Paulo Pinto wrote:Yes they are, kind of, because the ones small enough to fit in registers, like SmallInteger are converted to primitive types by the JIT. The programmer cannot see it, because it is considered an implementation detail, likewise in the other environments I mentioned. -- PauloYep, that is how for example .NET, Eiffel, Smalltalk, Lisp and many other languages work.An object in Smalltalk is not a primitive type. Even ints, floats, chars, etc. in Smalltalk are no primitive types but objects. Not wanting to be a rogue. Just pointing out ;-).
Feb 28 2014
On Thursday, 27 February 2014 at 10:27:41 UTC, Timothee Cour wrote:A1) Google's Dart (https://www.dartlang.org) looks like a very promising replacement for javascript. It can compile to javascript to ensure portability (but chromium runs it natively)No, neither Chromium nor even Chrome run it natively. Only Dartium which is a separate browser.* cascade operations: they perform a series of operations on the members of a single object: foo.bar(1)..baz(3) equivalent to: foo.bar(1) foo.baz(3)In D we can use with(foo) { bar(1); bar(3); } Pretty close. Dart looks like a very nice language for front-end web development indeed. If I was doing web-dev I would choose vibe.d + Dart combo. Some features like its constructors and short form of methods I would love to see in D too. As for compiling D to Dart I'm not sure that's feasible. You'll have to chop off lower half of it.
Feb 27 2014
Am 27.02.2014 18:29, schrieb thedeemon:On Thursday, 27 February 2014 at 10:27:41 UTC, Timothee Cour wrote:From what I understood on Dart talks last Google IO, work was planned to have V8 and Dart VM play together inside Chrome. Personally, I think unless Google pushes the language fro ChromeOS or Android, it will hardly get any real market size. Like it or not, JavaScript is good enough. On my field of work, it doesn't matter how many cool languages I know, we are usually bound by what the whole team is comfortable using, what the boss allows for and the technologies that are requested by the customers themselves. -- PauloA1) Google's Dart (https://www.dartlang.org) looks like a very promising replacement for javascript. It can compile to javascript to ensure portability (but chromium runs it natively)No, neither Chromium nor even Chrome run it natively. Only Dartium which is a separate browser.
Feb 27 2014
On Thursday, 27 February 2014 at 18:20:20 UTC, Paulo Pinto wrote: clipLike it or not, JavaScript is good enough.Really? I've been stuck for the past week or so trying to put together a browser based UI using JavaScript + HTML for a work related project. It has been a painful experience. In fairness to JavaScript, I didn't know the language very well coming in, but still I've found working in this setting rather frustrating. If the future of applications is really client-server based applications, where the client is basically a VM (if we consider the browser a VM of sorts) surely there is room for a better development model than this HTML + Javascript mongrel.
Feb 27 2014
On Thursday, 27 February 2014 at 18:37:51 UTC, Craig Dillabaugh wrote:On Thursday, 27 February 2014 at 18:20:20 UTC, Paulo Pinto wrote: clipI developed 99% of the JavaScript part of an application for a year, and I have extensive JavaScript knowledge. After all that, I wrote this. https://w0rp.com/blog/post/javascript-sucks/Like it or not, JavaScript is good enough.Really? I've been stuck for the past week or so trying to put together a browser based UI using JavaScript + HTML for a work related project. It has been a painful experience. In fairness to JavaScript, I didn't know the language very well coming in, but still I've found working in this setting rather frustrating. If the future of applications is really client-server based applications, where the client is basically a VM (if we consider the browser a VM of sorts) surely there is room for a better development model than this HTML + Javascript mongrel.
Feb 27 2014
On Thursday, 27 February 2014 at 19:54:04 UTC, w0rp wrote:On Thursday, 27 February 2014 at 18:37:51 UTC, Craig Dillabaugh wrote:Great. Now I have something to go an read for laughs whenever I feel my blood-pressure exceeding safe limits :o)On Thursday, 27 February 2014 at 18:20:20 UTC, Paulo Pinto wrote: clipI developed 99% of the JavaScript part of an application for a year, and I have extensive JavaScript knowledge. After all that, I wrote this. https://w0rp.com/blog/post/javascript-sucks/Like it or not, JavaScript is good enough.Really? I've been stuck for the past week or so trying to put together a browser based UI using JavaScript + HTML for a work related project. It has been a painful experience. In fairness to JavaScript, I didn't know the language very well coming in, but still I've found working in this setting rather frustrating. If the future of applications is really client-server based applications, where the client is basically a VM (if we consider the browser a VM of sorts) surely there is room for a better development model than this HTML + Javascript mongrel.
Feb 27 2014
On 27.2.2014 20:54, w0rp wrote:I developed 99% of the JavaScript part of an application for a year, and I have extensive JavaScript knowledge. After all that, I wrote this. https://w0rp.com/blog/post/javascript-sucks/I think it was someone on Slashdot who posted this wonderful comment: "JavaScript is a crap language that can't be fixed. If they ever add an honest garbage collector to the base language then most programs will delete themselves upon execution."
Feb 27 2014
On Thursday, 27 February 2014 at 19:54:04 UTC, w0rp wrote:On Thursday, 27 February 2014 at 18:37:51 UTC, Craig Dillabaugh wrote:Craig&w0rp I really do understand yeez. Really. At the moment I'm working with JS (again). Nightmare. Disaster. The server side is programmed in D, the user (client) side needs JS, ain't no other way. I have made a real, real, real, reeeeel effort, I've tried to replicate, mimic, emulate, imitate ... (running out of words here) every good programming pattern ever invented. But to no avail. JS is madness and I seriously don't understand why it has survived the way it is, why people just didn't abandon it years ago. It is madness. Frustration. Alienation. Every time I write something in JS, I feel like a complete programming novice, with the only difference that I know exactly what I want and how I would do it in any other programming language. But not so in JS. It defies reason and common human logic. JS degrades programmers. Years of experience are naught, you have to beg and cajole, you're at the mercy of a psychopathic tyrant. Whenever I program in JS I become highly irritable. When I program in D, I'm calm, I know what I want, and I know I will get it. I don't understand why we haven't got over JS yet. The Internet is so important and we still have to program things in JS. I don't get it. Now don't mention PHP with me ...On Thursday, 27 February 2014 at 18:20:20 UTC, Paulo Pinto wrote: clipI developed 99% of the JavaScript part of an application for a year, and I have extensive JavaScript knowledge. After all that, I wrote this. https://w0rp.com/blog/post/javascript-sucks/Like it or not, JavaScript is good enough.Really? I've been stuck for the past week or so trying to put together a browser based UI using JavaScript + HTML for a work related project. It has been a painful experience. In fairness to JavaScript, I didn't know the language very well coming in, but still I've found working in this setting rather frustrating. If the future of applications is really client-server based applications, where the client is basically a VM (if we consider the browser a VM of sorts) surely there is room for a better development model than this HTML + Javascript mongrel.
Feb 28 2014
On Friday, 28 February 2014 at 11:21:51 UTC, Chris wrote:On Thursday, 27 February 2014 at 19:54:04 UTC, w0rp wrote:"There is another option here. Use another programming language." Thanks for this blog. Whenever I program in JS everything feels rather 'undefined'. I would love to see the day when JS becomes obsolete.On Thursday, 27 February 2014 at 18:37:51 UTC, Craig Dillabaugh wrote:Craig&w0rp I really do understand yeez. Really. At the moment I'm working with JS (again). Nightmare. Disaster. The server side is programmed in D, the user (client) side needs JS, ain't no other way. I have made a real, real, real, reeeeel effort, I've tried to replicate, mimic, emulate, imitate ... (running out of words here) every good programming pattern ever invented. But to no avail. JS is madness and I seriously don't understand why it has survived the way it is, why people just didn't abandon it years ago. It is madness. Frustration. Alienation. Every time I write something in JS, I feel like a complete programming novice, with the only difference that I know exactly what I want and how I would do it in any other programming language. But not so in JS. It defies reason and common human logic. JS degrades programmers. Years of experience are naught, you have to beg and cajole, you're at the mercy of a psychopathic tyrant. Whenever I program in JS I become highly irritable. When I program in D, I'm calm, I know what I want, and I know I will get it. I don't understand why we haven't got over JS yet. The Internet is so important and we still have to program things in JS. I don't get it. Now don't mention PHP with me ...On Thursday, 27 February 2014 at 18:20:20 UTC, Paulo Pinto wrote: clipI developed 99% of the JavaScript part of an application for a year, and I have extensive JavaScript knowledge. After all that, I wrote this. https://w0rp.com/blog/post/javascript-sucks/Like it or not, JavaScript is good enough.Really? I've been stuck for the past week or so trying to put together a browser based UI using JavaScript + HTML for a work related project. It has been a painful experience. In fairness to JavaScript, I didn't know the language very well coming in, but still I've found working in this setting rather frustrating. If the future of applications is really client-server based applications, where the client is basically a VM (if we consider the browser a VM of sorts) surely there is room for a better development model than this HTML + Javascript mongrel.
Feb 28 2014
Chris:Every time I write something in JS, I feel like a complete programming novice,Probably that's part of the problem. More experience in a language helps. I suggest to use TypeScript (http://www.typescriptlang.org/ ), it has static types, more Java-style classes, better modules, and more; that give a more tidy and ordered kind of coding. If JavaScript gains integers too, programming in TypeScript probably becomes bearable even for die hard D programmers :-) Bye, bearophile
Feb 28 2014
On Friday, 28 February 2014 at 12:12:38 UTC, bearophile wrote:Chris:Unfortunately, you cannot get experienced in JS, there's always a new pitfall and the more you know it the more you hate it. If you don't hate it, you don't know it. On the bright side of things, JS teaches you how _not_ to do things and it makes you appreciate other languages, real programming languages. Programming is like this: Abstract concept of what you wanna do > find out how to do it in JS Programming is like this: Abstract concept of what you wanna do > find out how ... > wait, why the f***k is it not > stackoverflow > ah, you cannot do this in JS > ah, you can, but you have to reinvent the wheel > now! > wait, now, why the f***k > loop through the above ...Every time I write something in JS, I feel like a complete programming novice,Probably that's part of the problem. More experience in a language helps.I suggest to use TypeScript (http://www.typescriptlang.org/ ), it has static types, more Java-style classes, better modules, and more; that give a more tidy and ordered kind of coding. If JavaScript gains integers too, programming in TypeScript probably becomes bearable even for die hard D programmers :-)Thanks a million, I'll check it out.Bye, bearophile
Feb 28 2014
On Friday, 28 February 2014 at 12:12:38 UTC, bearophile wrote:Chris:Ah, no, it's MS. So is Silverlight. Don't like proprietary stuff. If Ceylon is real open source, great. I'm still dreaming of a language that will replace JS, not just compile to JS.Every time I write something in JS, I feel like a complete programming novice,Probably that's part of the problem. More experience in a language helps. I suggest to use TypeScript (http://www.typescriptlang.org/ ),
Feb 28 2014
On Friday, 28 February 2014 at 12:12:38 UTC, bearophile wrote:Chris:And now with full(native, i.e., not using a plug-in) support in Visual Studio 2013 check out http://blogs.msdn.com/b/mvpawardprogram/archive/2013/11/13/typescript-support-in-vis al-studio-2013.aspx ;)Every time I write something in JS, I feel like a complete programming novice,Probably that's part of the problem. More experience in a language helps. I suggest to use TypeScript (http://www.typescriptlang.org/ ), it has static types, more Java-style classes, better modules, and more; that give a more tidy and ordered kind of coding. If JavaScript gains integers too, programming in TypeScript probably becomes bearable even for die hard D programmers :-) Bye, bearophile
Mar 01 2014
On Saturday, 1 March 2014 at 16:37:36 UTC, Asman01 wrote:On Friday, 28 February 2014 at 12:12:38 UTC, bearophile wrote:As soon as Microsoft releases a Linux version I will be sure to try it out :o)Chris:And now with full(native, i.e., not using a plug-in) support in Visual Studio 2013 check out http://blogs.msdn.com/b/mvpawardprogram/archive/2013/11/13/typescript-support-in-vis al-studio-2013.aspx ;)Every time I write something in JS, I feel like a complete programming novice,Probably that's part of the problem. More experience in a language helps. I suggest to use TypeScript (http://www.typescriptlang.org/ ), it has static types, more Java-style classes, better modules, and more; that give a more tidy and ordered kind of coding. If JavaScript gains integers too, programming in TypeScript probably becomes bearable even for die hard D programmers :-) Bye, bearophile
Mar 01 2014
On Saturday, 1 March 2014 at 18:57:03 UTC, Craig Dillabaugh wrote:On Saturday, 1 March 2014 at 16:37:36 UTC, Asman01 wrote:Well, you will need to wait a while. :POn Friday, 28 February 2014 at 12:12:38 UTC, bearophile wrote:As soon as Microsoft releases a Linux version I will be sure to try it out :o)Chris:And now with full(native, i.e., not using a plug-in) support in Visual Studio 2013 check out http://blogs.msdn.com/b/mvpawardprogram/archive/2013/11/13/typescript-support-in-vis al-studio-2013.aspx ;)Every time I write something in JS, I feel like a complete programming novice,Probably that's part of the problem. More experience in a language helps. I suggest to use TypeScript (http://www.typescriptlang.org/ ), it has static types, more Java-style classes, better modules, and more; that give a more tidy and ordered kind of coding. If JavaScript gains integers too, programming in TypeScript probably becomes bearable even for die hard D programmers :-) Bye, bearophile
Mar 01 2014
Am 27.02.2014 19:37, schrieb Craig Dillabaugh:On Thursday, 27 February 2014 at 18:20:20 UTC, Paulo Pinto wrote: clipI didn't say I like it that much, just that it is good enough for what enterprise applications, my field of work, are about. So unless the browser vendors start supporting other languages, our customers will only ask for JavaScript, because it is easier to find guys when doing maintenance support. They don't care about Dart, TypeScript, CoffeScript, or whatever might be the flavour of the month, because it increases their problems to find people and their internal teams usually don't know those languages anyway. The same to any other language out there. Usually when I get to work on a cool language at the enterprise level, it is no longer cool, or it was brought in because some startup belonging to someone close to the CTO managed to sneak it in. The is of course my enterprise world, yours may vary. -- PauloLike it or not, JavaScript is good enough.Really? I've been stuck for the past week or so trying to put together a browser based UI using JavaScript + HTML for a work related project. It has been a painful experience. In fairness to JavaScript, I didn't know the language very well coming in, but still I've found working in this setting rather frustrating. If the future of applications is really client-server based applications, where the client is basically a VM (if we consider the browser a VM of sorts) surely there is room for a better development model than this HTML + Javascript mongrel.
Feb 27 2014
On Thu, 2014-02-27 at 19:20 +0100, Paulo Pinto wrote: […]From what I understood on Dart talks last Google IO, work was planned to have V8 and Dart VM play together inside Chrome.Dartium is a build of Chromium with both, so this is very much the direction that is possible.Personally, I think unless Google pushes the language fro ChromeOS or Android, it will hardly get any real market size. Like it or not, JavaScript is good enough. On my field of work, it doesn't matter how many cool languages I know, we are usually bound by what the whole team is comfortable using, what the boss allows for and the technologies that are requested by the customers themselves.Dart has a JavaScript translation back end, so could have a role very much like CoffeeScript – which arguably hasn't been that successful given jQuery, Backbone, Ember, Angular, etc. Ceylon has both JVM and JavaScript back ends and is targetted at end-to-end single language working: Ceylon in the browser, Ceylon on the server. If some of the FUD and prejudice that is being put about by innovation haters in the Javaverse can be overcome, I think Ceylon could be a big player in the game of Web applications and services. -- Russel. ============================================================================= Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder ekiga.net 41 Buckmaster Road m: +44 7770 465 077 xmpp: russel winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
Feb 27 2014
On 2/27/2014 2:19 AM, Timothee Cour wrote:* optional named parameters arguments (with simplest possible syntax)This comes up now and then. The problem with it is it makes function overloading a near impossibility to untangle.
Feb 27 2014
On 2014-02-27 21:43, Walter Bright wrote:This comes up now and then. The problem with it is it makes function overloading a near impossibility to untangle.We could quite easy add support for named parameters but still require using the same position of the arguments. I don't know if those wanting named parameters would be satisfied with this though. -- /Jacob Carlborg
Mar 01 2014
Jacob Carlborg:We could quite easy add support for named parameters but still require using the same position of the arguments. I don't know if those wanting named parameters would be satisfied with this though.I think requiring the same position of the arguments goes against one of the main points of having named arguments. A (temporarily?) solution to Walter's problem (has someone shown examples of the problem?) is to just not allow the use of named arguments for overloaded functions. This is not a large problem because when you have named arguments, you have less need for function overloading. Bye, bearophile
Mar 01 2014
On 2014-03-01 15:19:29 +0000, Jacob Carlborg <doob me.com> said:On 2014-02-27 21:43, Walter Bright wrote:I did implement something like that in DMD a while ago as an experiment. See the comments below that commit: https://github.com/michelf/dmd/commit/673bae4982ff18a3d216bc1578f50d40f4d26d7a Walter pointed out that it should work for template arguments. I agreed, devised a plan to restructure the whole thing to be less of a hack and make it works for templates, then I had no more time to put on this. :-( This planned restructuring did lead to a transition to type-checked arrays within DMD though, so the effort wasn't completely wasted. -- Michel Fortin michel.fortin michelf.ca http://michelf.caThis comes up now and then. The problem with it is it makes function overloading a near impossibility to untangle.We could quite easy add support for named parameters but still require using the same position of the arguments. I don't know if those wanting named parameters would be satisfied with this though.
Mar 01 2014
On 2014-03-01 17:19, Michel Fortin wrote:I did implement something like that in DMD a while ago as an experiment. See the comments below that commit: https://github.com/michelf/dmd/commit/673bae4982ff18a3d216bc1578f50d40f4d26d7aI based the "quite easy" on the few changes needed in your implementation.Walter pointed out that it should work for template arguments. I agreed, devised a plan to restructure the whole thing to be less of a hack and make it works for templates, then I had no more time to put on this. :-(That happens too often :(This planned restructuring did lead to a transition to type-checked arrays within DMD though, so the effort wasn't completely wasted.Nice :) -- /Jacob Carlborg
Mar 01 2014
On 2/27/2014 2:19 AM, Timothee Cour wrote:* import all except specified symbols: import 'package:lib2/lib2.dart' hide foo; // Import all names EXCEPT foo.As a general rule, negation features are frequently misunderstood, our brains tend to just not see the negation. One should positively import names, not negatively not import some. And there's the maintenance problem - what did the importer mean to do when the imported module adds a 'bar' name?
Feb 27 2014
On 2/27/2014 2:19 AM, Timothee Cour wrote:* cascade operations: they perform a series of operations on the members of a single object: foo.bar(1)..baz(3) equivalent to: foo.bar(1) foo.baz(3)D has ranges and algorithms to conveniently chain operations.* better way to define default constructors: class Point { num x; num y; num z; // Syntactic sugar for setting z and x before the constructor body runs. Point(this.z, this.x){...} } This is more explicit and flexible than D's way for default struct constructors, which can only allow to set all fields in order, without skipping some, and doesn't allow to do anything else in the ctor.D doesn't allow non-trivial default struct constructors for some good reasons, which are a long discussion we've had many times. These reasons don't apply to javascript.* named constructorsI don't see the point of such over using the factory method idiom.* distinguish integer divide (~/) vs divide (/), so that 5/2=2, 5~/2=2Such are needed so rarely - in C they are done with the modf function, and I've never seen modf used in the wild.* shorthand function declaration with => (used not just for lambdas)tomayto, tomahto :-)* for (var x in collection) //better syntax than foreach(var;collection)tomayto, tomahto* better syntax for optional positional arguments: void fun(int x, [int y, int z=3]){...} Thinking of which, this would actually solve a long standing problem in D, that of specifying optional parameters AFTER a variadic template: void fun(T...)(T args, [string file=__FILE__,int line=__LINE__]){...}Not sure what that is.* export for librariesWhat does that mean?* async/wait etcThose are a great idea, and we need to do them at some point.
Feb 27 2014
Walter Bright:Do you have an example of the problem?* optional named parameters arguments (with simplest possible syntax)This comes up now and then. The problem with it is it makes function overloading a near impossibility to untangle.The idea of having some syntax like this is nice, it reduces the poilerplace code, making the code less noisy and reducing the probability of the currenty common bugs caused by having fields and arguments with equal or similar names: class Foo { int x; this(this.x) {} void inc(int x) { this.x += x; } }* better way to define default constructors: class Point { num x; num y; num z; // Syntactic sugar for setting z and x before the constructor body runs. Point(this.z, this.x){...} } This is more explicit and flexible than D's way for default struct constructors, which can only allow to set all fields in order, without skipping some, and doesn't allow to do anything else in the ctor.D doesn't allow non-trivial default struct constructors for some good reasons, which are a long discussion we've had many times. These reasons don't apply to javascript.There is an enhancement request on this in Bugzilla. A shorter syntax for simple functions is handy, because one-line functions have become very common in D. Bye, bearophile* shorthand function declaration with => (used not just for lambdas)tomayto, tomahto :-)
Feb 27 2014
On Thu, Feb 27, 2014 at 2:40 PM, bearophile <bearophileHUGS lycos.com>wrote:Walter Bright: * optional named parameters arguments (with simplest possible syntax)Not sure what the problem would be. We could apply the same rules as for template overloading, ie error when there's a potential ambiguity (or even disable overloading for functions with named parameter until details are ironed out). Many languages have this, for good reason (discussed, again, many times).Do you have an example of the problem?This comes up now and then. The problem with it is it makes function overloading a near impossibility to untangle.
Feb 27 2014
We could kinda do named parameters today like this: ParameterTypeTuple!foo args; args.named_param = 3; foo(args); It would be nice if we could declare a variable inside a with(auto x = foo) like we can in if() too.
Feb 27 2014
On Thu, Feb 27, 2014 at 12:56 PM, Walter Bright <newshound2 digitalmars.com>wrote:On 2/27/2014 2:19 AM, Timothee Cour wrote:cascade != chaining: cascade: a.f1..f2..f3 <=> a.f1 a.f2 a.f3 chaining: a.f1.f2.f3 <=> ((a.f1).f2).f3)* cascade operations: they perform a series of operations on the members of a single object: foo.bar(1)..baz(3) equivalent to: foo.bar(1) foo.baz(3)D has ranges and algorithms to conveniently chain operations.
Feb 27 2014
* better syntax for optional positional arguments:http://d.puremagic.com/issues/show_bug.cgi?id=8687 : Variadic templates do not work properly with default argumentsvoid fun(int x, [int y, int z=3]){...} Thinking of which, this would actually solve a long standing problem in D, that of specifying optional parameters AFTER a variadic template: void fun(T...)(T args, [string file=__FILE__,int line=__LINE__]){...}Not sure what that is.* export for librarieshttp://wiki.dlang.org/DIP45What does that mean?
Feb 27 2014
* better way to define default constructors:I don't recall this syntax 'Point(this.z, this.x){...}' ever being discussed; can you please provide a link? * it avoids the following common bug: struct Point{int x;int y;} auto a=Point(1,2,3); //later on we add a field: struct Point{int x; int a; int y; } //woops! * less boilerplate / more DRY / more explicit: struct Point{ Foo x=32; Bar y; Baz z; this(this.y, this.z){} //instead of this(Bar y, Baz z){this.y=y;this.z=z;} } This is arguably a preferable syntax.class Point { num x; num y; num z; // Syntactic sugar for setting z and x before the constructor body runs. Point(this.z, this.x){...} } This is more explicit and flexible than D's way for default struct constructors, which can only allow to set all fields in order, without skipping some, and doesn't allow to do anything else in the ctor.D doesn't allow non-trivial default struct constructors for some good reasons, which are a long discussion we've had many times. These reasons don't apply to javascript.
Feb 27 2014