Live data from Hacker News

A Javascript journey with only six characters

jazcash.com

21–30 of 123 posts

Re: A Javascript journey with only six characters

#21

This is an extreme demonstration of the validity of a delightfully snarky blog post by Robert Harper on how dynamic typing is actually static typing using a unitype: https://existentialtype.wordpress.com/2011/03/19/dynamic-lan... A string is a Boolean is a number is a function, and braindead conversions can happen without anyone noticing. How does one keep their sanity using a language like that?

Keep it straight in your head, and use strict comparison. Hey, at least when JS implicitly converts your types, it actually does type conversion, rather than merely casting them, so you often get what you want (looking at you, C).

As for C, I have to contradict you. Implicit (numeric) type conversions do actual conversions (like char to int, or int to double; even pathological cases like pointer to what-counts-as-Boolean-in-C). The casts you are talking about must be explicit, and thereby are squarely the programmer's responsibility.

Of course, a language that forces all conversions to be explicit is preferable.

Re: A Javascript journey with only six characters

#22

Earlier quoted context omitted.

Keep it straight in your head, and use strict comparison. Hey, at least when JS implicitly converts your types, it actually does type conversion, rather than merely casting them, so you often get what you want (looking at you, C).

As for C, I have to contradict you. Implicit (numeric) type conversions do actual conversions (like char to int, or int to double; even pathological cases like pointer to what-counts-as-Boolean-in-C). The casts you are talking about must be explicit, and thereby are squarely the programmer's responsibility. Of course, a language that forces all conversions to be explicit is preferable.

I was pretty sure that char to int/int to char in addition was implicit...

Re: A Javascript journey with only six characters

#23

This is an extreme demonstration of the validity of a delightfully snarky blog post by Robert Harper on how dynamic typing is actually static typing using a unitype: https://existentialtype.wordpress.com/2011/03/19/dynamic-lan... A string is a Boolean is a number is a function, and braindead conversions can happen without anyone noticing. How does one keep their sanity using a language like that?

With something like flowtype.org.

Good answer. Of course, supplementing static typing after the fact only goes to show that it should have been built into the language to begin with.

Re: A Javascript journey with only six characters

#24

I'm a fan of Javascript. It has proper lambdas, true lexical scope, will soon have TCO, and is a really flexable language. But it's not without its warts, and this is one of the worst. Although it's sometimes fun to mess with, nonetheless. To see this taken to one of its logical extremes, check out If Hemmingway Wrote Javascript's entry for Douglas Adams: // Here I am, brain the size of a planet, and they ask me to w…

That reads like a close cousin of brainfuck...

Re: A Javascript journey with only six characters

#25

Earlier quoted context omitted.

As for C, I have to contradict you. Implicit (numeric) type conversions do actual conversions (like char to int, or int to double; even pathological cases like pointer to what-counts-as-Boolean-in-C). The casts you are talking about must be explicit, and thereby are squarely the programmer's responsibility. Of course, a language that forces all conversions to be explicit is preferable.

I was pretty sure that char to int/int to char in addition was implicit...

Yes, but the char still has to be extended to int. Or the int truncated to char. Except on systems where they happen to be the same size.

EDIT: Supplement: The notion of “type” in C is best translated as “memory layout plan”. Languages of the ML family (including Haskell), e.g., have a notion of “type” closer to mathematical concepts.

Re: A Javascript journey with only six characters

#27

I'm a fan of Javascript. It has proper lambdas, true lexical scope, will soon have TCO, and is a really flexable language. But it's not without its warts, and this is one of the worst. Although it's sometimes fun to mess with, nonetheless. To see this taken to one of its logical extremes, check out If Hemmingway Wrote Javascript's entry for Douglas Adams: // Here I am, brain the size of a planet, and they ask me to w…

That reads like a close cousin of brainfuck...

exactly

Re: A Javascript journey with only six characters

#30

It's too bad that people were willing to ostracize Brendan Eich for not being a cookie-cutter silly-valley progressive. Oculus is facing that now. It's the new mccarthyism.

It's hardly the new McCarthyism when there's no government force that leads the charge against private citizens, driving them to be unable to find any work in their field in the US.

The public deciding that it doesn't want to support someone is an entirely different phenomenon. The public can still be wrong, of course, but there's no need to conflate the two situations.

Post reply on HN