HuoLanguage / huo

interpreted language written in C
MIT License
212 stars 21 forks source link

add first class functions #34

Closed incrediblesound closed 8 years ago

incrediblesound commented 8 years ago

@TheLoneWolfling could you take a look over this? I kind of went into a trance and clobbered through this to get it working so there might be some areas for improvement.

TheLoneWolfling commented 8 years ago

Interesting.

I went through the code. Mostly seems fine, though with a few bugs or potential bugs. Won't have a chance to actually compile / run it for a while, though.

incrediblesound commented 8 years ago

Great! I'll go over each one of these and try to address all the issues. I think you're spot on about the execute.c function getting too big. One of the problems I had getting this to work was reasoning about what happens to the ast as it makes it through that massive function. I'll try to fix some of these issues as well as add some better organization before I merge this branch.

incrediblesound commented 8 years ago

I've been playing with this branch and I've found the issue of managing scopes to be extremely tricky when dealing with first class functions. As a result I think I will close this PR until we have a better system for managing scope. Instead of doing FC functions I will try to do some of the organizational stuff to make the execute.c function clearer and less buggy. I will add the stack trace function to the main branch, though, because that's super useful.

TheLoneWolfling commented 8 years ago

Makes sense.

Perhaps we should open a bug for "scope issues" and go from there, then. I have a few ideas on the subject.