Ask HN: What is a "toy" language?

I have heard the term "toy language" far too many times. To me, the term has zero validity but maybe someone else can convince me otherwise.

Is this a language that is too high-level? Too simple to pick up? Serves no purpose that other languages can't fill?

I have heard the term applied to everything from Java to PHP to Perl to Python- pretty much everything besides C[++] and Assembly.

This makes no sense for two reasons:

1) No language is suitable for every task and as a consequence some (traditionally) toy languages are better suited for some tasks than C.

2) Chances are if you have heard of a language then a decent number of people have found it useful for some task.

Can you code a web app entirely in C++? Sure. Would you ever want to do this as a start up? No. Too time consuming/prone to error/not agile. But you can come up with a list of things C++ is great for just like you can come up with a list of things "toy languages" are great for.

So why must decent languages be branded as toys?

  • toy language is what you call a language that is incomplete or without a large enough featureset to be truly useful in solving problems or creating applications. or, a heavily pruned down version of a normal language.

    you'll mostly see toy languages in academia. i had to learn one for my compiler class.

    people referring to any widely used language as a toy languages are either trying to insult it, look down their nose at it, or are idiots. or, perhaps all 3.

  • Yeah, you could easily see people call PHP a toy language because of its problems in the past (and some present), however, its one of the most widely used languages ever.

    Like noodle was saying, I saw a bunch of toy languages in college that a professor would write solely for the purpose of teaching something; a language that would never be used in industry.

  • PHP simply lacks the facilities that professional developers need. Inability to override class methods and lack of threads are two obvious but extremely important examples. There are many other reasons to call it a toy language, inconsistent interfaces, bolt-on object-orientation poor variable scope rule in classes which mean you need $this everywhere and the really poor excuses that the PHP development team seem to come up with for the lack of appropriate development all contribute to keeping PHP as a novice and hence toy language. All these problems are addresses in other modern OO languages like Java, C#, Ruby. All in all its not a language you should use for a long-term project eventually you just keep rubbing up against its limitations.

  • There are definitely toy languages. lolcode is definitely a toy.

    On a serious note, people dislike PHP because many of the language choices seem to have been made oddly to put it nicely. It's also domain specific. While I wouldn't want to play a 3D game written in Python or Ruby, they're programming languages that you can make whatever in. When someone tries to make a desktop app in PHP, it's just odd. PHP is a language in the way that JSP is. It's wonderfully useful for web stuff, but it's not a programming language made for everything - just web stuff.

    And, to be honest, PHP does a lot of things that really aren't good practice if you're doing something other than creating a domain specific language. Like, you connect to a database with mysql_connect() and then run queries with mysql_query() and you don't have to pass in a link identifier unless you're querying a new DB. It completely isolates programmers from the reality of how variables like that get managed in memory. It's not a bad thing when you're just trying to get something done, but it also means that PHP people have no idea what a local static variable is and what that means (maybe it clings to you after you run the laundry?).

    Likewise, a lot of programming is dealing with scope. PHP tends to muddle scope with globals in a way that can be convenient for web programs, but also means that you get a lot of people that don't know program design messing around in it.

    Similarly, PHP isolates users from types more than most scripting languages. What's false? Who knows? It's actually a problem as 0 == 'apple' returns true. Yep. Integer zero is equal to any string. While I'm not a typist, I do think there are problems when you muddle too much casting to different types automatically.

    In terms of Python/Perl/Ruby, well, some people are against scripting languages. They're slower than something like C or Java and want to be snotty about the relaxed programming they offer. Plus, well, you don't find C programmers that don't understand things like garbage collection or algorithm performance standards. Sometimes in the scripting world there are a bunch of cut/paste, keep trying something until it works programmers. They don't know what they're doing and stumble along not realizing why something works or doesn't. How many scripting programmers have thought about references vs. copies?

    A lot of it is people being snotty about things, but a lot of programmers really don't understand programming. So, whatever. People call things names. It's going to happen whether they're geniuses or idiots.