Closed mathroc closed 9 years ago
So far as I can see this is great! Only problem: doesn't amend the spec to actually add boolean literals (and remove true
and false
variables, if I put them in).
Oh and yeah, I'm fine with contributions, I'd really appreciate them since I don't work on this often enough.
yeah I first tried to declare true
and false
in stdlib.js but with this implementation I had to use it like that : false. not. show.
By making true
and false
literals I can now use them without the dot : false not. show.
I might have missed something obvious ^^ but as you said it can be changed later
(spec amended)
Oh, I mean define them in stdlib as variables, not functions. stdlib functions are just variables containing function values anyway, I just didn't make plain def yet.
You only have to use the . because using a function's name merely places it on the stack, while . executes it. For a variable you need only place it on the stack, nothing to execute.
Oh that was actually so simple! https://github.com/mathroc/Firth/commit/814b29e7a37d193c0cede9ab6ce1279a0efde51e ( note: I guess that would need to be flagged as a constant to disallow shadowing or changing the value )
would you like me to replace this PR with it instead ?
Well, I've decided that I want to allow shadowing (and I'll close that issue) after reading Guido's blog post I linked earlier. So, I'll keep it as a literal so it can't be shadowed. We can always change it later to not be a literal, but the reverse is less doable (backwards-compatibility, though that's currently unimportant). By the way, I don't plan to allow variables to be re-assigned, so that's not a problem. (If they are to be mutable, I guess I'll require some special flag?)
One final thing: you should probably move this pull request to another branch on your repository, and revert your master branch to be in sync with mine.
(otherwise you're gonna have problems later!)
Anyway, thanks for doing this! :)
Hi!
If you don't mind contributions, here is an implementation of boolean constants & algebra. Is that what you has in mind in #2?