- One executable that is the runtime, accepting one argument: the source code file. - No linters. Code is auto-formatted. - No modules. Includes can be namespaced/aliased. - No package manager. Include by Git URL with tags. - No type annotations. Automatic type-checking. - No user-defined types. A few good types is better. - No null. Set membership with maps is better. - No exceptions. - No loops. List and map compre…
> - Terminating. All programs terminate. How are you side stepping an NP-hard issue like the halting problem?
Ask HN: What would be your “perfect” programming language?
111–120 of 182 posts
Re: Ask HN: What would be your “perfect” programming language?
#112Python, 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.
Admittedly, Go doesn't have enforced whitespace, but it has standardized code format, enforced by the `gofmt` tool, so in 99% of cases it looks as good as Python. The syntax is somewhat similar - there is a lot of type inference and duck typing, yet the type system is still static (which removes a majority of type errors), with opt-in dynamic typing through `interface{}` (the empty interface, which is implicitly implemented by every type) and type switches.
Go is compiled to native code, and can be statically linked, making it perfect for containerization, since you don't need any dependencies whatsoever - just copy the executable into a scratch container and be done with it.
It's also very fast, and incorporates an async-by-default runtime which is scalable to an arbitrary number of CPU cores out of the box. Imagine asyncio, but multithreaded, and without the async/await keyword littering - that's Go runtime.
My favorite feature of all - the `select` keyword, which waits for a fixed set of channels (similar to queues, but lightweight), and receives/sends a value from/to the first channel that has another goroutine (similar to thread, but lightweight) sending/receiving a value to/from it. It's a very useful feature for building event-driven systems.
Sorry for the sales pitch. I just really like Go :)
Re: Ask HN: What would be your “perfect” programming language?
#113Re: Ask HN: What would be your “perfect” programming language?
#114I was going to say "a better version of C#" but maybe an entirely different language would be better. C# uses stack and heap for memory management, which is to say this is an entire language designed around memory management. Should memory management be a core of a modern programming language? Available memory has expanded like 1000x in the lifetime of this language.
That’s what you get when memory is considered to be something programmers shouldn’t care about.
Re: Ask HN: What would be your “perfect” programming language?
#115The perfect programming language fits the way I think. But other people think differently, so my perfect language won't be perfect for them, and vice versa. There is no answer that is perfect for everyone. There can't be.
The perfect programming language would handle all the incidental complexity of the problem I'm trying to solve. But different people are trying to solve different problems, and what is incidental complexity to me is essential to someone else. Again, there cannot be a perfect answer.
We can get better, but we can't get perfect.
Re: Ask HN: What would be your “perfect” programming language?
#116C but with the following changes: - Guarantee 8-bit byte and twos complement - No undefined behavior. All behavior is defined even if the ramifications of that behavior are not. Use after free? The data in the memory location is written-to or read-from, not omitted by compiler, and programmer is responsible for the second- and third-order effects thereof. Signed integer overflow? You get the assembly ADD instruction…
Re: Ask HN: What would be your “perfect” programming language?
#117C but with the following changes: - Guarantee 8-bit byte and twos complement - No undefined behavior. All behavior is defined even if the ramifications of that behavior are not. Use after free? The data in the memory location is written-to or read-from, not omitted by compiler, and programmer is responsible for the second- and third-order effects thereof. Signed integer overflow? You get the assembly ADD instruction…
Well, let's baseline with Zig. Because that adds build dependency management. Building code has got to work like GO: it needs to be built into the compiler. Let's also add formal methods that's bound up with the implementation language even if it starts 1-way from FM to code. Correctness in any of its several dimensions would be better with pragmatic FM together with the code itself. Zig, which deals with C/C++ code,…
I like playing around with the side effects of things, abusing pointers etc. It isn't safe, it isn't sensible but I'm not aiming to do safe sensible things.
Re: Ask HN: What would be your “perfect” programming language?
#118Python, 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 worked with Python for years, and Go (golang) turned out to be everything I wanted Python to be. Admittedly, Go doesn't have enforced whitespace, but it has standardized code format, enforced by the `gofmt` tool, so in 99% of cases it looks as good as Python. The syntax is somewhat similar - there is a lot of type inference and duck typing, yet the type system is still static (which removes a majority of type er…
An adorable mascot.
;-)
Re: Ask HN: What would be your “perfect” programming language?
#119Earlier quoted context omitted.
I've worked with Python for years, and Go (golang) turned out to be everything I wanted Python to be. Admittedly, Go doesn't have enforced whitespace, but it has standardized code format, enforced by the `gofmt` tool, so in 99% of cases it looks as good as Python. The syntax is somewhat similar - there is a lot of type inference and duck typing, yet the type system is still static (which removes a majority of type er…
Go also has something other language lack... An adorable mascot. ;-)
I love that lil guy like you wouldn't believe :)
Re: Ask HN: What would be your “perfect” programming language?
#120- Good documentation.
- Always twos complement. (For one thing I would have -fwrapv being the default setting.)
- Reduce some undefined behaviour, so that more of the behaviour is defined or partially defined.
- Types specifying how many bits, or can specify in terms of other features (e.g. pointer size).
- Not Unicode.
- Avoid the confusing syntax for types that C has.
- The C comment syntax has /* even though / followed by * would be a valid sequence in C, so, such a conflict should be avoided in a better programming language.
- Parameterized types.
- Must still have the goto command.
- More powerful macros and preprocessing (including auto-generation files too), including a superset of the capabilities of C, but with possibility of hygienic macros, too.
- Better namespacing possibility than C.
- Does not need too many extra libraries than C, and can be used with any libraries for C programs (including possibility to be called from C codes, too).
- Many of the GNU C features.
- Associated data with types (which may include functions, constants, numbers, strings, other types, etc).
- You can still use pointer arithmetic, etc like is also possible with C.
- String type being the length and pointer to beginning of data; this way you can easily make slices. For compatibility with C codes, they will by default also always having the null terminator after the data, too.
- A few additional things, too.