3 September 2010, 9:59 am
This version brings very few changes from the 0.7.5 release (that i forgot to announce). Most notably is that the tests are fixed, I SWEAR they worked here! Along with that I made the date parsing stuff save time zones when given rather than converting everything to UTC by default, this means when you tell it #2010-03-14 1:59:26am EST5EDT# it’ll keep it in the EST5EDT timezone for you. I also removed a single reference to Date::Manip which hasn’t been strictly needed for some time and I just kept missing the reference.
The 0.7.5 release brought the new function syntax and the depreciated & operator.
This release is because I’m planning on doing something special for the 2 year anniversary of the project next Saturday, keep an eye out!
22 August 2010, 1:54 pm
I’m getting ready to prepare a new release of Language::Farnsworth with some of the new features I’ve added before I start work on the module system. The reason being is that the module system is going to require some massive changes to the whole interpreter. These changes will cause me to have to refactor lots of code and end up with a more complete design for an interpreter. I’m updating the TODO on here to reflect what I need to do before I finish this. I’ve also added a minor design document on how I plan on adding “lazy” type evaluations at http://simcop2387.info/todo/magic-values/
19 August 2010, 9:38 am
Ok I’ve gotten my notes up as a preliminary spec on how modules are going to work in Language::Farnsworth. You can view it at http://simcop2387.info/docs/module-draft-spec/ . I’d like you guys to check it out and leave me some comments on it.
10 August 2010, 6:06 pm
I’ve been considering how i want to make namespaces in farnsworth and the way i’ve used them is quite considerably influenced by my experience with perl. On the filesystem I think the way perl handles it (e.g. POE::Component::IRC is the file POE/Component/IRC.pm, by convention and by the fact that C<use> expects to find them there) is probably the way to go. But should I have the actual creation of the namespace up to the file, or should i have it enforced like in java? Just some things for me to mull over but I would love to hear from anybody out there on the topic. So PLEASE leave a comment?
8 August 2010, 4:04 pm
I’ve finally gotten an Evaluator working here so that you guys can play with the language without having to spend large amounts of time figuring out how to get the damned thing running yourself! This means you can spend my money and cpu time (in 25 second increments) to play around and have fun!
There is a 25 second timeout setup so any infinite loops will still halt.
7 August 2010, 11:59 pm
The following feature is intentionally unsupported since it has come into being while being considered depreciated until a more permanent and logical system can be created.
To go along with all the other changes I’ve made I have added in a new operator that lets you get at the actual value for a function so that you can do some rather nifty things with it
And what you’ll get is something like
{`arr byref isa [] , x isa ...` arr = arr + x; }
While this might seem a little pointless at first it’ll let you do things like alias one function to another without having to create a new stack frame and function to accomplish it.
defun foo={`x` x * x};
defun bar=&foo;
Now that too seems a little pointless since you could just define both of them to be the same to begin with, BUT when you’ve got a large function that you don’t want to have to copy and paste to multiple places it ends up very nice since you can have the interpreter do it for you. Now the really nifty part is that you can redefine an existing function while keeping around a copy of the original so that you can call back to it. This lets you create an automatically memoized version of an arbitrary function (assuming you know the inputs) and other really nifty and nasty things. I’m going to write a quick and dirty little memoization system in a bit to demonstrate this.
7 August 2010, 8:00 pm
I’ve finally gotten all the work done on merging the lambda and function code. This resulted in a slight API change that nobody cared about because there isn’t anyone else out there doing anything with this. The new syntax looks like this:
What this means is that you can define a function by creating ANY expression that evaluates out to a lambda and assign it to the function. So you can do something like this:
defun count={`` var count=0; {`` ++count}} [];
Then when you use the function C<count[]> it’ll increment the variable every single time and return the value. This makes for a slightly nicer looking way to make static values between function calls since before you’d have to do something like:
{`` var count=0; count{} := {++count}} [];
Which can start getting rather nasty looking to work with and debug when you start to have large functions or large amounts of static variables (Though when you have multiple functions sharing the same variables you can still use this form).
4 August 2010, 10:50 pm
I’ve decided that i’m going to be removing the unit[] "function" since its using a different part of the api that I don’t like anymore. I also suspect that none of you are using it (who are you guys anyway?). I’ll be replacing it with an operator instead since that’s really what it was. I don’t know if i’ll keep that operator around forever or not but it will most certainly be with more notice and more thought about removing it. Let the complaints begin, (pretty please? someone? is there anyone out there?)
30 July 2010, 1:36 pm
Ok, I’ve just pushed some changes to the git repo (http://github.com/simcop2387/Farnsworth ) that FINALLY adds code for doing return[] finally. I’ve also added tests for it, since I’m sure I’m going to break it. This marks a wonderful day for Farnsworth since it now allows you to write code that isn’t perfectly rigidly structured!
I’ve got one more error message to rewrite and to add the new function syntax so that I can finally get other things I want in place (mostly objects).
25 July 2010, 5:13 pm
I’ve spent a good deal of time recently getting rid of all the calls to die and friends in the code and switching them to the error reporting module i’ve made so that i can start adding exceptions and a proper return[] to the language. I’ve also finally cleaned up the massively strange looking error when you try to convert between incompatible units, Conformance error, left side has different units than right side $VAR1 = bless( [ 'kg' ], 'Fetch' ); that didn’t even tell you about both sides to one that’s much more readable and understandable Conformance error, can't convert from length to mass. I still have one more error message that i know of that is incredibly obtuse and that will come next.
Now that i’ve switched away from using die directly i can start making an error object that i pass around instead so that i can differentiate between an error and a return value. I needed this because i need to use die in perl to smash the stack and go back to the point where the function or lambda was called. This is all because currently I’m using a recursive descent pattern to evaluate the AST from the parser (I’m not doing any processing on the AST for optimization or even to order operations directly so that i can avoid deep recursion, it is a design flaw but it makes hacking on it SO easy.)
After i finish this error code stuff i’m going to begin working on the rest of the stuff needed for merging the lambda code and function code which amounts to creating an operator (currently thinking of using ~) to get a reference to a function and then moving to the new syntax, defun foo={`bar` bar ** 2}; I’ll keep the old style syntax around for some time though.