Nathan-Wall / proto

A programming language derived from JavaScript which emphasizes prototypes, integrity, and syntax.
Other
12 stars 1 forks source link

Remove unnecessary expects at compile time #82

Open Nathan-Wall opened 10 years ago

Nathan-Wall commented 10 years ago

It'd be a nice optimization if we could remove unnecessary calls to functions like ExpectObject at compile time. For instance, SetSymbolTransferability calls ExpectObject and it's currently only being called from within Define after that function itself has already called ExpectObject. It's correct for the SetSymbolTransferability to call ExpectObject because this function could be called from different call sights in the future and it can't necessarily depend on always having ExpectObject called before having its arguments passed in.

What would really be great is if the runtime builder could statically analyze and determine at compile time that ExpectObject can be removed from SetSymbolTransferability if it's just going to be redundant.

I'm not sure how difficult this would be...