Live data from Hacker News

Ask HN: What would be your “perfect” programming language?

news.ycombinator.com

151–160 of 182 posts

Re: Ask HN: What would be your “perfect” programming language?

#152
post #62

Earlier quoted context omitted.

Why async/await? As go and soon java with loom shows it is quite a misfeature, if anything. Otherwise, I like your idea on checked exceptions, I think they are a very good feature, but somehow got a bad name and thus not experimented with as often. Your last point sounds quite macro-ish, so I guess the LISP-fanatics will come in in droves and tell you that they already have that in their language :D But relatedly, tr…

I compare async/await with manual threading, or with callback hell, and in both cases it is a great improvement. I haven't tried Java with Loom and haven't done much in Go, so maybe that style is indeed better. Right now it feels spooky if my lightweight thread can suspend at any time, deep down in some function call. And what if you accidentially don't call a "loomified" IO function, but a plain blocking one? I like…

Loom also comes with something called structured concurrency and many other improvements to make taming lightweight threads easier.

Nonetheless, Java is a very “pure” ecosystem in that basically 99.9% of the ecosystem is written in Java itself — so besides the tiny amount of FFI, every method you might call is ready to be magically unblocking.

Re: Ask HN: What would be your “perfect” programming language?

#154

Earlier quoted context omitted.

Right, but embedded systems are what I do, so a language that requires termination would not be perfect for me ...

Can you give an example of why you need non-terminating semantics? Programs can still be run "forever", if they are run for each input while maintaining terminating semantics for deriving output. Abstractly the Turing machine is infinite, but in the real world input and output is almost always finite and discrete. I guess you wouldn't be able to use it to build a machine that is supposed to display Pi or Fibinocci?

Here's a CPU that controls an automobile engine. Inputs are the position of the throttle, and the rotational position of the crankshaft. Outputs are instructions to the fuel injector and the timing of spark plugs firing.

You can terminate that program when the user turns the engine off.

Or, you can say the program should consist of "read the stored state, re-configure the fuel injectors, fire a spark plug if one is supposed to fire now, update the stored state, and terminate". You could say that it should be written that way. But when you do, you've got a bunch of cynical old embedded software people saying, "Explain to me how that is better in any way? Does it make the program easier to write? No, it doesn't. Does it make it less error prone? More reliable? No and no. Does it make it use fewer resources? Also no. So why in the world do we want to write it that way?"

Re: Ask HN: What would be your “perfect” programming language?

#155

Python, but with static typing and compiled to native code. I love Python's syntax. It's usage of whitespace forces people to have some semblance of proper formatting. Overall, I find Python code extremely easy to read. But my god is it slow, and I've always assumed a lot of its slowness is due to being interpreted and the duck typing.

> I've always assumed a lot of its slowness is due to being interpreted and the duck typing Being interpreted definitely, even though there are some rarely-used methods that can improve that. Additionally, there are more than one implementations of Python, and pypy is much faster than the standard CPython. As for duck typing, why would that make a language slower exactly?

> As for duck typing, why would that make a language slower exactly?

I assumed it would result in basically every operation to require multiple lookups to figure out how types would interact at runtime. Like a simple "foo.bar(biz + baz)" would have to check the types of biz and baz, figure out how to add them, then look up the foo object and make sure it has a function named baz, and then call it.

I assumed all these lookups and verifications would add significant overhead.

Re: Ask HN: What would be your “perfect” programming language?

#156
post #98

Earlier quoted context omitted.

object variants are more flexible than enum types so what you see as a limitation others don't.

No, I want first class algebraic datatypes that don't make easy things hard i.e. https://forum.nim-lang.org/t/904 vs `#[derive(Eq)]`

Libraries exist: https://github.com/haxscramper/nimtraits https://github.com/andreaferretti/patty https://github.com/alaviss/union Again we are not new to this problem and already offer alternatives.

Re: Ask HN: What would be your “perfect” programming language?

#157
I'd start with most of the best parts of Delphi/Free Pascal

Insanely fast recursive descent single pass compilation.

Assignment and equality test have different tokens := vs =

Var parameters instead of messing with pointers

Functions return values, procedures don't

Strings that are automatically reference counted (no allocation or garbage collection to worry about), counted (so you always know how many bytes of text you have), and just work, yet can hold at least a gigabyte

Units for separate compilation

Strong typing

Then I'd add some things from elsewhere

pre and post increment/decrement from C

declarative programming, using a "magical assignment operator" <<==<< or something like that to indicate that the left is always made to equal the expression on the right, and updated any time the expression changes. -- from an experiment called Metamine that was here a few years ago

Post reply on HN