Sebastian\’s Coding Blog

Archive for February, 2007

No future for references

Posted by randomz on February 26, 2007

I have been hesitant the whole time whether the concept of references could contribute to Sofu. And I have come to the conclusion that for the purposes of Sofu, the costs of adding references outweigh the benefits.

What are the costs? References add a whole new layer of complexity to any Sofu file that uses them. A Sofu file can now be semantically incorrect; before, the semantics of a Sofu file where solely defined by the library user.

What are the benefits? In my opinion, they are pretty small. It is always possible to refer to a Sofu object by using its name. Of course, in this case, you are limited to referring to objects inside a certain application-defined Sofu structure (as opposed to somewhere inside the file); on the plus side, this structure can even be in a different Sofu file, which would be a security risk to allow with references. And if you really want it, you can still build complete reference paths by creating lists of strings and numbers. (You have to do the dereferencing yourself, though.)

All the mechanics for dereferencing reference paths that I have already implemented inside Sofud will probably stay. For example, it is very useful to have a reference path inside an error message (instead of just line and column number). The whole ReferencePath class (source) will probably also be part of the public interface, also probably a rarely used part.

Posted in Sofu | Leave a Comment »