Back to News
Advertisement
Advertisement

⚡ Community Insights

Discussion Sentiment

67% Positive

Analyzed from 467 words in the discussion.

Trending Topics

#language#natural#hour#vox#programming#languages#example#number#current#minute

Discussion (6 Comments)Read Original on HackerNews

DonaldPShimoda•about 2 hours ago
I don't mean to be overly disparaging, but I think the concept of "programming languages that look like natural language" has been played out. The result is that it's generally just a bad experience.

Natural languages are useful in large part because they have ambiguity and semantically fuzzy edges. That's how we get jokes and poetry and implication, among plenty of other things. Not only that, but natural language necessarily evolves over time: a word that may have meant something very specific at one time can come to be associated with things that may not seem related at first. (For example, I recently learned that average, as in the process of dividing a sum among a number of constituents, originates in an obligation of a ship's crew to compensate a merchant for the value of goods lost in transit.)

Meanwhile, the value of programming languages is specifically that they are designed to be un-ambiguous: they are meant to correspond one-to-one from text on the screen to actions in the computer. Nobody wants a programming language that probably corresponds to a particular set of instructions but might correspond to another. (Or, at least, nobody wants this for serious purposes; it definitely sounds fun, in a way.)

So when we unite the two by trying to implement a programming language that "feels like" natural language, we end up obfuscating intent rather than clarifying it: your programmers now have to learn a different, very specific verison of the natural language at hand (e.g., English) that only applies to this specific set of circumstances. They have to learn a bunch of conventions that are phrased in ways that might, to one programmer or another, feel like they mean one thing but actually mean another. It's an endeavor that often seems good to the person (or small group of people) designing it, but these languages frequently are inhibited from widespread adoption due to footguns the designer(s) did not encounter themselves, because, of course, the language is written in their dialect of the language.

TheJostler•about 2 hours ago
Honestly interesting take. The language doesn't allow much expressiveness, so it is not hard to learn to write. The strength is understandability. In a world where more code is written by AI, auditability feels increasingly important. At the end of the day it's just an experiment; let's see where it goes.
Someone•about 3 hours ago
Code example FTA:

  to 'start clock'.
  Print "Press Ctrl+C to stop showing the time.\n".
  while true,
    A number called 'this hour' is current time's hour,
    A number called 'this minute' is current time's minute,
    A number called 'this second' is current time's second,
    print "\r->\t{this hour:02}:{this minute:02}:{this second:02}\t<-" without newline,
    Wait 1 second.

  'start clock'.
There’s a a race condition there because “current time” is read thrice (it could be 7:59:59 when “this hour” is computed and 8:00:00 when “this minute” is computed)

Also, on “reads like English”: “while true” doesn’t sound like that to me. Neither does

  {this hour:02}
TheJostler•about 2 hours ago
The example has been fixed!
TheJostler•about 3 hours ago
I spent the last seven months building Vox. It compiles a constrained, sentence-based form of English directly to x86_64 NASM assembly. No runtime, no libc, no GC. The compiler is written in Rust.

Example:

  create the log file at "/tmp/init.log".
  open the log file for writing.
  write "init started" to the log file.
That compiles to a static, bounds-checked ELF binary. I also used it to start building a minimal Linux distro in pure Vox: initramfs, shell, and coreutils (https://github.com/TheJostler/voxos).

Pre-1.0 and moving fast. GPL-3.0-or-later.

Site: https://vox-lang.dev Repo: https://github.com/Vox-lang/vox

mvetsalo•about 2 hours ago
Somebody reinventing COBOL...