Hacker News new | ask | show | jobs
by TheAsprngHacker 2924 days ago
For identifier validity checking and recursion, you should look into let-rec and its differences from ordinary let. As for API checking, you would probably be using typeclasses or interfaces to specify an API. Even if the individual URL objects do not exist yet, a URL type should exist (at compile-time) that defines what operations are valid. I don’t think that a separate function would need to be generated for each link, but you can build arbitrary operations at runtime with first-class functions.
2 comments

Thanks! I'll look into let-rec, I've never heard of it before :)

Everything in my language is an expression, so I guess you could say every literal in the language is first-class.

I was thinking for i/o, I could use promises. The promise would resolve to whatever type makes sense for that resource- defined either by a library or by the program.

Of course, that brings up "arbitrary operations at runtime". My target after transpiling is JavaScript, which has a wonderful JIT compiler already. I need to learn source mapping and stuff so I can make error-tracing work nicely, as it's simply not possible to catch any possible error at compile-time.

Oh I read what letrec was, that is exactly the solution I was looking for! :)