Ask HN: What are the nice feature you need in a programming language?
8 points ·
Hashex129542
·
1. async function will be called from no async function but no async/await keyword. If you want to block main thread then block_main() function will be used. block_main() /* operations */ unblock_main()
2. protocol can inherit another protocol(s) & protocol can confirm a class like swift.
3. no `let`. only `var`. compiler can optimize further.
4. if (a == (10 || 20 || 30) || b == a) && c { }
5. `Asterisk` is replaced to `x` operator for mul operations.
What are the features you found or you need in a programming language?
ActorNightly ·6 hours ago
People want to be able to write either python or javascript (i.e the 2 most widely used languages) , and have a compiler with an language model (doesn't have to be large) on the back end that spits out the optimal assembly code, or IR code for LLVM.
Its already possible to do this with the LLMs direct from the source code, (although converting to C usually yields better results than direct to assembly) but these models are overkill and slow for real compilation work. The actual compiler just need to have a specifically trained model that reads in bytecode (or output of the lexer) and does the conversion, which should be much smaller in size due to having a way smaller token space.
Not only do you get super easy adoption with not having to learn a new language, you also get the advantage of all the libraries in pypi/npm that exist that can be easily converted to optimal native code.
If you manage to get this working, and make it modular, the widespread use of it will inevitably result in community copying this for other languages. Then you can just write in any language you want, and have it all be fast in the end.
And, with transfer learning, the compiler will only get better. For example, it will start to recognize things like parallel processing stuff that it can offload to the GPU or use AVX instructions. It can also automatically make things memory safe without the user having to manually specify it.
Show replies
dusted ·4 hours ago
I want types, like typescript, but instead of compilation, there should be a "boot type check" which does about the same checks as tsc, but the types should be first-class, available at runtime, so I can pass them around, create, read, update and delete them at runtime.
I want runtime code creation that is more robust than creating source-code as strings and then compiling them, I want first-class code-as-data like in LISP. I want to be able to define some blocks of code, and conditionally combine them the new blocks which I can compile to functions. I want to be able to derive functions that is more, less or different from their parents (for example, removing or replacing a number of its statements) (basically, I want to have enough control that I can chose a pattern of generating ideal callbacks with no conditionals)
I want to be able to express (I use % for lack of a better idea right now, this is the type-safe version of the syntax))
const someBlock = (a: number, b:string)=%{ console.log(a+2+c); }
And pass it to a function: myFunc(1, someBlock, 3);
(and someblock should be able to use it: function someFunc( aBlock: % ) { const a = 1; const c = 3; someblock; }
I want better introspection, if I pass a function, there's no reasonable, robust and performant way to reason about that function.. You can't access its parameter list to learn the names of its parameters, their type or number, you can't access its body to learn what it does, you can't even see its return type, to determine what to do with its result, mind you, most of this metadata is already present in the js runtime, just not exposed in a good way to the language.. You can't even access the ast.
GianFabien ·4 hours ago
ARM architectures are getting instruction set bloat and RISC-V is also tending that way with many variants being produced.
I prefer minimal syntax, e.g. Lisp, Smalltalk, Self. Then let the abstractions be plugged in with appropriate compiler support. I find the idea of blessed built-in types constrain implementation designs due to their prevalence.
mikewarot ·2 hours ago
I once saw this in a language called metamine and the demo was amazing, mixed imperative and declarative programming interweaved.
rawgabbit ·7 hours ago