JarrettBillingsley
Joined: 20 Jun 2006 Posts: 457 Location: Pennsylvania!
|
Posted: Mon Jul 10, 2006 12:29 pm Post subject: Identity Crisis? |
|
|
As of late, I've started to realize the complexity of MiniD. As the (far-from-finished) compiler source approaches 6000 (non-blank) lines of code and 140KB, I'm beginning to wonder if all this complexity is worth it. Thinking about the implementation of some of the features, I've come to realize that I'd have to also implement things like RTTI, as well as a slew of things to consider since MD modules should be dynamically importable and linkable. It's getting to be downright scary.
So I'm thinking, "why not make it more Squirrel-like?" Then, the more I think about it, the more I wonder if it's even worth making another language that's kind of like Squirrel and kind of like Lua, which doesn't really offer anything new and which (of course) isn't compatible with either. Hm.
Sooooo...... even with all of that, I'd still like to make something of MiniD. I'm thinking Lua-esque, with just about everything in tables, but with a more robust (read: more than virtually nonexistant) module system, and with objects like in Squirrel. Something like:
Code: | module test;
import io;
import string;
def fork(x, y)
{
// "Default parameter"
if(y is null)
y = 10;
io.writefln("fork: ", x + y);
}
// A class!
class A
{
this()
{
io.writefln("A ctor");
}
def mValue = 0;
def mName = "";
// "Properties"
def value()
{
return mValue;
}
def name(val)
{
if(val is null)
return mName;
else if(typeof(val) == "string")
return mName = val;
else if(typeof(val) == "integer")
return mName = string.toString(val);
else
throw "Invalid type for A.name"
}
// A plain old method
def incValue()
{
++mValue;
}
}
// Inheritance
class B : A
{
this()
{
super();
io.writefln("B ctor");
}
}
main()
{
fork(5);
fork(8, 3);
def a = new A();
a.name("Hello");
io.writefln("a is called \"", a.name(), "\"");
a.name(4);
io.writefln("a is now called \"", a.name(), "\"");
io.writefln("a's value is ", a.value());
a.incValue();
io.writefln("a's value is now ", a.value());
} |
It looks kinda cool. |
|