| New toys |
[01 May 2005|01:14pm] |
FireFox: For a long time now, I have been an Opera user. Today, I tried switching to FireFox again, and I think this time it will be for good. The reason I decided to try switching again was reading about the "BugMeNot" plugin for FireFox on Slashdot. BugMeNot is a good idea, and a plugin to do it automatically is awesome.
Also, the "FlashGot" plugin, combined with Free Download Manager, replaces the "simple thing" I liked most about Opera: Opera's built-in download manager was very good.
Finally, I will slightly unclutter my desktop by replacing 2 links with one: I was using Opera for all my browsing, and IE for gmail. Now, Firefox can fill both those roles. These three things together are enough to tip the scales very slightly in Firefox's favor.
Darcs: I have been trying Darcs out for the past few weeks on my personal projects. It is excellent. Version control is now simple, and I don't feel like I'm touching "black magic" every time I need to manage a repository.
PQI I-Stick: This is another recommendation I got from Slashdot comments: The PQI I-Stick. I have kind of wanted a USB thumb drive for awhile now, but most of them seem cheesy and cheap. The particular comment on Slashdot mentioned how this guy's i-stick has been through the wash a couple of times and still works fine. Combine that with it's size: It is so tiny, it comes with a sort of "docking adapter" that makes it more like a regular thumb drive's size. It easily fits in a wallet with a sort of "credit card" carrying case it comes with.
|
|
| AST, bootstrapping |
[06 Mar 2005|01:25pm] |
Typically, when a compiler or interpreter runs, it needs to load a source file. It invokes the parser, which parses the source file to end up with an Abstract Syntax Tree (AST).
The interpreter really cares about this data structure. The source code doesn't figure into anything anymore.
For Fish, I want to have "user definable syntax", meaning an arbitrary amount of "macro-ing" and "customization" of syntax. As an example: I want it to be the case that if you were so inclined, you could write a "syntax package" which was equivalent to python, and just load "python code" into the Fish VM.
Really, this means loading a source file is the same thing as running an arbitrary program/function, which inputs the source file and outputs the AST. This fits in very well with the staged programming concept, because it just means that you are being explicit about another stage. Most programming languages have 2 stages: "compile time" and "run time". Fish will add, at the very least, "parse time".
So, implementing Fish prototypes, I have always run into a problem: What sort of parser should I write for the "core". The "core" is the lowest level language and some libraries, such that higher level languages (syntax packages) can be written.
I found a good idea yesterday: Don't have a parser for the core. I use python for implementing my prototypes... Just have the core be the direct datastructures in python.
LISP people reading this would probably say "duh", because when they write new "languages"/dialects, this is the obvious way to do things.
|
|
| Overloading |
[06 Mar 2005|12:53pm] |
I talked online with Chad recently. We were talking about programming language stuff. It cemented my thoughts on "operator overloading" (and function overloading).
For awhile, when thinking about functional programming, I was kind of thinking that operator overloading wasn't necessary. Haskell and ML don't really have it. Haskell's operator is actually a function call to "Number.+", so it's more like a virtual function than an operator overload. ML has . for floats, etc...
But some people (Chad :)) really like overloading. And, when designing a language, I wouldn't want to say "no, you're not allowed to do that because I don't like it." So I was worried. Also, how can you implement overloading in a functional language?
Chad is working on a higher level functional language for GPU shaders. He brought up an example:
double x = x*2 double x y = (x y)*2
Kind of a silly example, but it gets the point across.
double is overloaded, there are two different "ways of calling double".
Then, Chad brought up: foo x = (x 1) + (x 1 2)
Would you want to be able to do that? At first glance, you could pass double into foo, and it would work, because double has two forms.
What I feel: Doing two definitions of double should be ok. The "foo" example is not ok... it should fail to typecheck.
Basically, you make function and operator overloading a purely syntax thing. This concept was in the back of my head the whole time we were talking about it, because I was thinking of how C works, how it creates two different functions, which have mangled names that describe its complete type.
The perfect example, I think, is: Consider a person writing "z = x*y", when you are dealing with floats. Then consider: "matrixA = matrixB * matrixC". In both of these examples, the * symbol is used for "multiplication". In the first one, it's "number multiplication", and the second, it's "matrix multiplication". The key is that when someone writes these expressions (on paper doing a math problem, or in a text editor writing some code), they're not getting confused with what they're doing. They don't think "I want to number multiply these matrices"... It just happens to be the case that both operations are denoted by the same symbol.
So, overloading is purely a syntax thing.
Back to Chad's example: You could rewrite foo as: foo x y = (x 1) + (y 1 2) And then call foo with: "foo double double". This will be OK. foo could now typecheck, and that invocation could pass in the two different forms of double.
Note that this is fine from a semantics standpoint. It can still get pretty hairy from a syntax standpoint: When you just have: "x = double 4", do you want x to be 8? or do you want x to be a 1 argument function (the second form of double, partially applied)?
If you went with a different syntax than Haskell/ML's style, one which wrapped function arguments, you could go: "x = double(4)" or "x = double(4,_)" to declare which double you wanted. (Think up your own favorite syntax for a "placeholder for partial application").
|
|
| Linux |
[06 Mar 2005|12:41pm] |
I gave Linux another try over the weekend. (As my primary workstation, that is. I have a few Linux machines already doing server-type stuff)
It still didn't work out. Windows has its problems, but for now at least, it's still my preferred environment. I primarily use my computer for programming and playing games, and Windows is better for both. I can deal with not playing games, but the user interface is so much better for "getting real work done"... I spend more time tweaking settings and configuring stuff in Linux than actually doing stuff.
When I lived in Atlanta, for nearly a year, I used pretty much only Linux, and did lots of programming, mostly Java. Even after that, I still prefer the Windows UI. At some point, I'll get a Mac mini and give that a try. I kind of suspect that once I do, there's no going back.
The main reason I gave it another try was that my Windows install was getting messed up again, and I was getting frustrated. It wasn't spywared or anything, but just little things. One big thing: once every two weeks or so, I had to boot from an install cd to repair my system. The SYSTEM registry hive was getting too big. As part of the bootup, win2k just fails if the registry hive is more than 16M... This was very annoying. Also, the registry files are sort of a "block device" for the registry. I only had about 3M of data in there, but it would get fragmented, and growing to more than 16M every couple of weeks.
The procedure for fixing: Boot from the setup disk, get to a recovery console, backup WINNT\system32\config\system, copy WINNT\restore\system over the one in system32\config, and reboot. Now you are booting with a "default" system hive, so you have no drivers or anything. Now, use regedt32 to mount the backup hive into your registry, then run a program called regcompact (download online, it's not an MS program) which will defragment the file. Then reboot, use the setup disk to get the recovery console, and copy the now defragmented file back into place.
Also, every time you boot the setup disk, it spends like 8 minutes loading drivers for a zillion different devices, so this whole process takes 20 minutes, even if you've gotten lots of practice (like doing it twice a month for 6 months). What a hassle.
|
|
| First actual post |
[06 Mar 2005|12:37pm] |
|
Funny, I put up my website like 6 months ago, and paid for LJ so I could have the "embedding" thing, and then never used it. Chad has bugged me again about "writing stuff down", so I'll give it a try. I'll do several posts now on recent thoughts, each with their own topic, rather than one big one.
|
|
| Website up |
[16 Oct 2004|06:09pm] |
|
Finally put up a website. Pretty bare right now, but the essentials are down.
|
|
| navigation |
| [ |
viewing |
| |
most recent entries |
] |
|
|
|
|