Morning | Fri Dec 16 10:05:21 2005 |
| Lifetimes between Eye Blinks | |
| Topics: Programming | |
|
The last few days have been strange, but not in a way I can really quantify. The general feel of life seens different though -- my life is not quite shaped like this. From things I do and ways I am to events and interactions, it's different. Hmm. Last night, for the first time in awhile, I put some more time into the POUND code, implementing BLOG entry links with a special syntax in the markup language. As usual, whenever I leave a project for a long time, I have a urge to deeply refector/rewrite it instead of actually work on it as it is. That's not hard to overcome though. It took a bit of tweaking to bring the code up on my laptop, but it's worth doing. I'm considering a major change to code style though - currently all the functions in my software are using argument lists, but named parameters are pretty, and Perl can do then with a bit of work. I need to look into the modules I've heard about that should theoretically make that concise. For those who haven't worked with this before, C-style argument lists, which I presently use in perl, work like this: To call a function sthtml($pagetitle, undef, undef, $customcss);Start of that function
sub sthtml
{
my ($pagetitle, $rss, $atom, $css) = @_;
...
Those argument lists must be passed in the correct order, and as a result whenever you want to call the function, you must go look up the arglist to call it properly unless you happen to remember (you usually will remember if there are two or fewer arguments). Some programming languages, such as R, Mathematica, and ObjC, allow named parameters, where a function has a number of named parameters, usually with default values, and calling a function fills in those parameters explicitly, a la
sthtml(pagetitle => 'This is my page', customcss => $mycss); Named parameters tend to make code much easier to understand, and it is possible to do this in Perl. The only reason I haven't been doing it all along is the function start code needed to catch that tends to be unattractively large and bulky. Again, I've heard rumours of code to concisely automate that code. Before I go off to handle other things, two amusing political news stories for you. | |