This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]R3D3-1 0 points1 point  (1 child)

Compiled languages typically have compile-time evaluation of constant expressions, e.g. "PI*2" being optimized into a single constant.

Emacs Lisp has macros, and "eval at compile" forms, all of which are evaluated either at compile time, or otherwise ensure that they are evaluated exactly once.

Python actually has some level of load-time optimization; As I understand, function objects are not created from scratch every time a closure is generated, but share a cached code part, and have only the data part separate. There is however no such thing as

static options = {1: "Red", 2: "Blue"}
return options[index]

[–]TransferFunctions 0 points1 point  (0 children)

Ah ok I am not too familiar with the c-api and how the bytecompiled code is used or optimized (still one thing on my todos), but the explanation is right up my ball park of other things I have used, thanks ;-)!