DEV Community

Discussion on: Java is Unsound: The Industry Perspective

 
rosstate profile image
Ross Tate

Ooohhh, I think I get what you're saying. Sorry, I was so focused on the example that I didn't carefully consider the words around it. I changed the phrasing to make my intent clearer. Can you let me know if the new version addresses the concern? If so I'll update the other renditions of the article.

Thread Thread
 
webreflection profile image
Andrea Giammarchi

It's better ... but ... TypeScript, as well as Flowtypes, allow types in JS via tooling that would never let you write the following code:

function increment(i:Number):Number {
  return i + 1;
}
// double error, the inpout is wrong, expected result too
const countdown:String = increment("98765432");
Enter fullscreen mode Exit fullscreen mode

The JS env and surrounding tooling got better since 90's so once again,
is it really necessary to include at all in this document, an outdated, misleading, inappropriate, abuse of a scripting programming language that already has been historically confused, or wrongly compared, to Java ?

What I am saying is that the correct replacemente for this sentence:

"Sure, JavaScript can successfully execute this program despite its nonsensical nature,"

would probably be like:

"Sure, a version of the code that wouldn't have types specified in it, used by a rookie developer that wouldn't care about JavaScript primitive types and their coercion possible side effects, could successfully execute this program despite its nonsensical nature and wrong expectations in terms of returned value ..."

Do you see this is not going to really add anything to this document?

Do you see there's no point at all to even name JS in a scenario that nobody would be since year 2000 ?

Anyway, thanks for, at least, trying to understand what I meant.

Best Regards

Thread Thread
 
rosstate profile image
Ross Tate

If I felt like this example wasn't necessary, I would remove it. But the problem is that it's in there because people were getting confused about specifically the issues I discuss there, namely that soundness is about the interplay between the type system and the semantics. Covariant arrays, raw types, and JavaScript were each explicitly mentioned by various people, so I discussed each one.

Moving forward, it sounds like, although not perfect, I've at least managed to make things a little better. Ideally I could provide the fully clarified explanation, but attention spans are limited, so I'll leave it at this compromise.

Thanks for helping me understand your perspective better, even though it took me a while to at least get a little close!

Thread Thread
 
dubyabrian profile image
W. Brian Gourlie

The juxtaposition seemed appropriate and certainly didn't appear to be an affront to javascript or javascript developers. I'm thoroughly confused by the strong reaction to it.

Thread Thread
 
rosstate profile image
Ross Tate

Oh, Andrea, I forgot to say, that website you linked to is amazing! Java is to JavaScript as ham is to hamster. Fantastic! I'll keep that site in mind next time a friend gets confused.