Sebastian\’s Coding Blog

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.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

 
%d bloggers like this: