Woops, I'm late posting this week. I haven't got too much to show however there has been some progress.
The big piece of work was on the compiler. Let's say we have this bit of code:
(let ((fn #'sin)) (funcall fn 10))
line 1: Let there be a variable named fn which is bound to the function 'sin' line 2: Take the value bound to 'fn' and call it as a function with the argument '10'
Now as of last week this wouldn't work in my compiler. The reason was that functions in GLSL can have overloads, for example
pow can take a
vec4. So when I said
#'sin (get the function named
sin overload was I talking about?
This meant I had to write this:
(let ((fn #'(sin :float))) (funcall fn 10))
#'(sin :float) reads as 'the function named sin that takes one argument of type float'.
This worked but felt clumsy so my goal was to make the first code example work.
The way I went about it was to say:
When we compile a form like #'xyz where there are not argument types specified, work out all the functions named 'xyz' that can be called from that position in the code. Pass this set of functions around with the variable binding information in the compiler an then when the user writes a
funcalllook at the types of the arguments and work out which overload to use.
The nice thing was that the code to pick the most appropriate function for some args from a set of functions already existed, naturally as we need to do this for regular function calls. So that code was generalized a bit and recycled.
The rest took some time as I kept bumping into details that made this more complicated than I had hoped, mostly because my compiler was (and is) written on the fly without any real technical knowledge. I've certainly learned stuff that I want to apply to the compiler, but some of these things require large changes to the codebase and I'm not really ready to get into that yet. I have some time constraints as I want to give a talk on this in the near future so I really just need it to work well enough for that.
Other than this I speed-watched a couple of intro unity courses and started reading their docs. The courses were ok'ish I got what I needed from them but I'm hoping that wasnt meant to be good code style as it felt very messy. Time will tell.
That's all for today, Ciao