6

I don't understand why languages like JavaScript and PHP decided to bolt on typing and object-oriented stuff retroactively. In fact, it actually makes me kind of angry.

The whole point of weakly-typed languages is so that you don't have to worry about the types. Everything that you do to an object is evaluated at runtime. The advantage of this is so you don't have to worry about types which improves speed of development. You do lose the benefits of strongly-typed languages, but I'm assuming everyone who uses a weakly-typed language is ok with that tradeoff, otherwise they would be using a strongly-typed language.

But then they go and add strongly-typed things to weakly-typed languages, like they somehow "discovered" that there are actually benefits to using strongly-typed languages. The thing is that adding this back in just dilutes the weakly-typed nature of the language to the point where you don't really get the benefits of its strongly-typed-ness or its weakly-typed-ness. And don't tell me you can just use either, because if you're working on a project with multiple people you can never really be sure what is going to happen if both the options are there.

I have an idea, how about we let Java be good at what it's good at and let JavaScript be good at what it's good at, and stop trying to make them into the same language. Languages have strengths and weaknesses and that's ok. We just have to learn what they are and when it's good to use certain languages over others.

Comments
  • 2
    Explain how exactly weak typing improves the speed of development. Or any other supposed advantage of weak typing.
  • 2
    @Lensflare the language itself is easier to implement. There are fewer syntax rules to evaluate when every variable might have any property and be used in any fashion.
    At the dawn of JavaScript it was easier to convince browser maintainers to support the language by minimizing how hard it would be to implement an interpreter.
    Things have changed, but until recently the very existence of a nearly-every-platform language was a productivity boost.

    Nowadays, those weakly typed advantages are like those magnetic stripes in credit cards - it made sense at the time and helped bring us to where we are today. And now it would be very hard to get rid of it.
  • 4
    You always have to worry about types, the moment you define at least one function that is called at least once you have types that you need to keep in sync. Some languages alleviate the burden by throwing compile-time errors for bad code. That code wouldn't work without type checking, it would just fail later, preferably while writing some sort of data file.
  • 2
    @JsonBoa yup. There are of course advantages for the implementers of the language and being easy also helped JS becoming so popular, but there are really no advantages for the actual developers using those languages that have weak typing.
  • 1
    Python throws syntax errors when the corresponding line is executed. You can't tell me that this helps anything other than ignoring showstoppers. As @JsonBoa said, type checking is another feature that needs to be implemented and a lot of languages don't have the resources for it, but pretending that this has benefits other than saving langdev time is an unhealthy coping.
  • 2
    @lorentz I think you misunderstood my comment. I completely agree with you. There are no benefits other than making it easy for people to implement such a language.
  • 1
    @Lensflare I wasn't responding, we were in a data race
  • 2
    By the way, I also had to remove type checking (and consequently all forms of polymorphism other than closures) from my language in order to deliver on schedule, so I deeply understand the struggle, but I would never call this a feature. It's a termporary tradeoff. Working examples are more valuable than ideas about a perfect language that I can't afford to build.
  • 2
    @lorentz is your language publicly accessible? I’d like to have a look at it maybe 😄

    Edit: ah, it was Orchid, right? I’ve seen it on devRant somewhere.
  • 2
    @Lensflare yeah, the latest version on Github isn't working but my local build is, I'm a bit busy with uni but I'll push a version soon that compiles, supports IO and simple text, number and function manipulation.
Add Comment