Re:What is a programmable programming language? (2019)
by xigoi on Monday June 06, 2022 @01:18AM
(#31637425)
It's not, as Nim clearly shows.
How do you optimize code without knowing the types of variables?
Re:What is a programmable programming language? (2019)
by pjmlp on Monday June 06, 2022 @01:35AM
(#31637499)
By having the compiler doing type inference, and if that isn't enough, you can explicitly define types in Common Lisp.
http://clhs.lisp.se/Body/d_type.htm
I bet Allegro or Lisp Works don't have any issues generating better code than Nim.
Re:What is a programmable programming language? (2019)
by moonchild on Monday June 06, 2022 @01:19AM
(#31637429)
The experience of writing nim is very different from the experience of writing common lisp. Nim may be more mutable than c, but that is not saying much.
> How do you optimize code without knowing the types of variables?
Very carefully.
Re:What is a programmable programming language? (2019)
by mhh__ on Monday June 06, 2022 @01:28AM
(#31637463)
Guesswork, static analysis, experiment etc. JSC does all kinds of black magic to make JavaScript run fast.
For a large amount of programs (basically all "classical" programs like you'd read about in the past rather than modern apps) you have a fairly clear path through the code for their data, this means that you can optimize that path.
This doesn't mean the performance will be as good as a statically typed language but keep in mind 90% of compiler optimization is basically useless on many programs vs. the 10% that makes the important bits run fast.
Re:What is a programmable programming language? (2019)
by samatman on Monday June 06, 2022 @06:54AM
(#31638930)
The Mike Pall method uses a typed SSA intermediate language, and adds trace guards anywhere it can't guarantee a single type. LuaJIT optimizes fairly well.
Re:What is a programmable programming language? (2019)
by mbrodersen on Tuesday June 07, 2022 @10:22PM
(#31662477)
F# and ocaml does that all the time using type inference.
Common lisp is compiled to optimised native code.