I have a new idea of feature for a programming language, something I would call "variable expression".
Imagine that you have
Speed = deltatime * 5
It is necessary to update "speed" at each time because the value of deltatime changes.
Imagine a programming language that allows you to create a variable using an expression, but that changes each time the variables using to compute the expression change.
So, if deltatime changes, then speed changes automatically (no need to update!).
this already exists, it is called reactive programming.
this already exists my friendo
>>61668167
>>61668169
>born too late to have a truly original idea
Life is suffering.
>>61668198
Did you really think no one else had thought of this?
>>61668129
nigga that's a function
>>61668198
don't feel bad anon, that idea is just about 60 years old.
Still there are a lot of open problems and things to do in programming language theory, if that makes you feel better.
>>61668129
>speed = time * x
t. brainlet.
>>61668129;; in Common Lisp
(defun speed ()
(* deletatime 5))
;; but really it should be:
(defun speed (deltatime)
(* deletatime 5))
;; example:
(defun update-position ()
(setq position (+ position (speed) )))
Jesus christ, this is bait. He posted a picture of a lambda, whew.
In case it isn't or there are other anons who want to learn. Here is how you would do this in JS, with a lambda expression.var speed = () => deltatime * 5;
>>61669537
cont.
Also, it is not a good idea to do this it gets messy. It would be better to do something likevar speed = deltatime => deltatime * 5;
So that it at least follows functional programming.
It gets messy because speed depends on deltatime, well what if deltatime depends on two other variables which each have a messy web to follow when tracing code.
>>61669537
>>61669589
At least call it getSpeed(), you barbarians
JS getters and C# properties are more closely what op described though than functions
>>61668129
You mean a function?float speed(){
return deltatime * 5.0f;
}
Place it wherever you would use Speed()