February 28, 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)
>>>
>> This comes up now and then. The problem with it is it makes function overloading a near impossibility to untangle.
>>
>
> Do you have an example of the problem?


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).


February 28, 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.
February 28, 2014
>
>
>
>  * 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.
>

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.


February 28, 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

February 28, 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:
>> On Thursday, 27 February 2014 at 18:20:20 UTC, Paulo Pinto wrote:
>> clip
>>>
>>> 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.
>
> 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/

@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 ...

February 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:
>> 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:
>>> clip
>>>>
>>>> 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.
>>
>> 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/
>
> @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 ...

"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.
February 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
February 28, 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 ;-).

February 28, 2014
On Friday, 28 February 2014 at 12:12:38 UTC, bearophile wrote:
> 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.

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 C/Java/D/C#/Python ...

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 ...

> 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
February 28, 2014
On Friday, 28 February 2014 at 12:12:38 UTC, bearophile wrote:
> 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/ ),

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.