Quote:
Original post by cmp
damm i really should get a new keyboard, i had written a reply and then the z key got stuck an messed everthing up, so have to write everthing again.
When computers turn bad! My cousin watched as her whole essay was deleted - her delete key got stuck.
Quote:
the compiler knows with new remote type(), that type may be remote, so it creates a proxy object.
Ah, another keyword :P.
Quote:
as thought about i really liked the idea of methods beeing objects with a () operator - at least i would explain it this way from my c++ background.
but when you write goblin.init(), it looks to me like goblin is a global var, wich should really be avoided in oop languages, you could of course say that every superclass is contained in the base class (i think you call it object), but this would mean that the baseclass is changed everytime you add a new class to your project, something wich does not look right to me - and you can't implement the baseclass in your own language.
additional you are blurring the lines between object-instances and classes: when you write integer a = integer.init() integer is a class and an instance - or init is static, but then you can't say integer.async().init() because what should async() return? it can't return classes it would have to be an instance, this way integer is an instance of class and a class itself at the same time, wich looks like a design error to me.
Okay, here goes.
There is a global object for every class. This has the same name as the class. You ask it to create new instances of the class. But this object can also have methods and properties of it's own. When you say "integer i" you are creating a variable (container) to store an instance of type integer. When you say "integer.alloc()" you are asking the global integer object to create a class for you. The "init()" method after is calling on the new instance, and it returns itself. When you are declaring a class "-" means that the method / property is for the instance "+" means it is for the super. If you declared a class like this:
class turkey - turkey init() return self - void gobble() + turkey alloc() // implemented in object (nasty C++ code) + string color() return "Brown"
This code would work:
turkey t = turkey.alloc().init()t.gobble()cout.print(turkey.color())
This code wouldn't
turkey t = turkey.alloc().init()turkey.gobble()cout.print(t.color())
They both function as different objects, yet they are linked. This is how object oriented is done in Objective-C.
Yes I agree that this is bluring the line between class and object, I just have to get my words right. A class is both these objects, an object's parent is the class it inherited from. An object's owner (I used to call it super) is the static object that always exists. An object is an instance of the class (not the owner). The problem (as you pointed out) is that both the class and the super have the same name. I'm not sure how to fix this. Maybe this:
turkey t = owner(turkey).alloc().init()
But really I don't have a problem with it, just it means that it is hard to explain to others, and the terminology gets mixed up.
I really like the static owner object idea, it means that common design patterns can be created easily, and that you have control over the creation of your objects. If you don't want any objects of a certain type to be made, just override the alloc method and return null. This would be the same as just having one static class that is semi (packages) global.
Also this works well when creating objects differently.
Quote:
Quote:
Yeah, I want a type of generic (template) support, but I'm not sure if it should be in the language or not. The only thing I think it is really useful is data structures, and if I can supply the structures (lists etc) then there won't be a need for templates. There will be support for them in the vm so I can always add support later.
but sometime the user will implement structures himself and now he either has to rewrite it everytime or use boxig - i think this is the term microsoft used for object o = (object)integer_var.
What structures will they implement that can't be done with objects and lists? I was thinking about adding a map template as well.
Quote:
the only problem is that you have to supply some boostraping code, since it is like the chicken and the egg. i use xslt as a boostraping language, since it is fairly easy to write and very flexible when transforming xml code.
I was wondering about that...
Quote:
from what i have got you should never write sth. like tag : /* nothing */, because the parser then get stuck, because he can't distinguish between tag other_tag and nothing.
and from what i remeber you should rahter use left recursion with yacc, so you should write: tag: tag other_tag | other_tag.
Ouch!
This grammer which has only 1 shift / reduce conflict (the traditional if conflict) written by the man himself uses the same method as I do (which is left recursion). In this zip file the readme contains the same method to do an optional tag. These are just two of the sources I found offhand.
Left recursion is doing it this way
tag: other_tag | tag other_tag;
Compared to right recursion which is
tag: other_tag | other_tag tag;
That is the difference.
If you pretend to be the parser, you will see that it doesn't need to keep anything on stack, every point along the parsing of multiple other_tags the whole thing is already matched by one of the options, it just adds other_tags onto the end.
It doesn't matter what order you state the or's (I think) I've always just done it in order of complexity - which has worked so far.
Have you used bison and generated the .output file? If not you may find that you have a lot of conflicts. It took a while to make it work, but now I have no conflicts.
Quote:
i had done the same, but since i'm now writing everything in xml, there is no problem with oeprator precedence.
How is there no problem? You still need to work out which one comes first if you want to allow an expression like a + b * c.
Quote:
i think i will still use lex for parser generation but everything beyond this will be implemented in my language. so generated the tree is done with lex and the transformation of the tree to the xml file is done in my language.
Lex doesn't generate a tree, it generates tokens. Do you mean lex and yacc / bison working together?
Quote:
Quote:
i = [3,3][0,2,3:1,2,3:2,2,3]
btw. this is the same way my calculator does define multi-dim-arrays ;)
but it has the problem that you are restricted to 2 dimension with this syntax.
and with [[1,2,3][1,2,3][1,2,3]] is the problem that you won't have a multidemensional array, but an array of arrays.
Yep, no support for multidimensional arrays. What are you doing with them in a scripting language anyway? :P
[Edited by - umbrae on November 6, 2004 12:29:55 PM]