humbletim / glm-js

JavaScript adaptation of the OpenGL Mathematics (GLM) C++ library interfaces. JavaScript adaptation of the OpenGL Mathematics (GLM) C++ library interfaces. (project currently inactive)
http://humbletim.github.io/glm-js/
Other
43 stars 5 forks source link

Duktape: Remove undefined behaviour by passing functions as strings. #12

Closed cheako closed 9 months ago

cheako commented 6 years ago

A proof of concept: This code only partially works, not sure what needs fixing.

A lot of the eval(Function.prototype.toString()) behaviour is undefined. The spec only mandates that it creates an identical object, but that's actually impossible if for example this is no-longer the same. I'm not sure what behaviour glm-js relies on, nor is it even practical to implement in duktape. It's far better to remove the relises on undefined behaviour.

https://en.wikipedia.org/wiki/Undefined_behavior#Risks

cheako commented 6 years ago

My testing shows that object constructors return the object constructor function and if this function is called it returns the same.

cheako commented 6 years ago

Control, Test.

Looks like now GLM.mat3.undefined0 function is not being run.

cheako commented 6 years ago

Control, and Test now match behaviour for a simple test case.

cheako commented 6 years ago

I got glm.common.js to run under duktape https://github.com/cheako/cheako-vulkan/blob/60f63ead64aa23391bf7ba34c860acebb9761dc6/015glm-js/default_js.js#L18

cheako commented 6 years ago

I've abandoned this and have started https://github.com/cheako/cglm-js

humbletim commented 9 months ago

Hi Michael -- I recently rediscovered your incredible PR porting glm-js towards DukTape. Thank you so much for your dedication and ingenuity! While the glm-js project is now sunsetting (see #19), I wanted to express my sincere gratitude for your effort and respect your decision on moving forward. Your work was truly inspiring, and I appreciate you pushing boundaries with glm-js. Best regards, -Tim