|
(try again, first attempt got rejected by the server) ketmar wrote:
On Sat, 28 Jun 2008 01:19:13 +0100 Stephen Kellett <lua@objmedia.demon.co.uk> wrote:There are a lot of built in types in JS. Don't beleive me? - please examine the Firefox source.can't find anything there. number, string, boolean, array, object, null, undefined. that's all. 'native objects' aren't 'built-in types'.
>From the perspective of the user of Firefox, that is splitting hairs mighty fine.
just looked at my own Lua sources: all my classes has "tostring" and "className". it's not enforced by the API (and it's good), but it's there, i'm not too lazy to write several lines of code.
That is the problem. You think that because people are free not to write as well as you, that that is good. I don't agree. When they come looking for information from a tool they are confused as to why that information is not there. Even more so if they've used a similar tool from a different language where type information is present everywhere (C, C++, Java, etc).
The above is also a problem with all of the dynamic languages that allow anonymous functions. These are really useful, until, again, you get into the realm of wanting a tool to tell you what the object is ("its a function", "yeah but what function?", "I don't know", "why not?", "because you didn't tell me what it was when you gave it to", confusion!). Its quite hard trying to explain to a developer that wants to know what is doing X to his object Y that the function has no name because the developer wrote the code that way. For some reason people seem to think that although its an anonymous function it does really have some form of (human readable) identity that can be tracked. Yeah, right!
When we started with JavaScript, we also got "Object" for most objects, at first. And, if you go via the JS API, that is what you will get. We did a lot of digging under the hood and found we could get useful type information most of the time. I can't remember the details right now, I can look it up if people are interested (I doubt it :-). When we tried the same thing for Lua we drew a blank. Lua doesn't store any info other than the basic stuff that says I'm an Integer, I'm a table, I'm userdata. Once you get to that, if the writer of the table hasn't provided a name for you, thats it, you've got "Table_0x0034fbac" as you identifier. Very useful :-(
>From my own perspective, if I'm in a debugger, the debugger should be able to tell me I'm working with a SpaceShuttle not Table_0x0034fabc. If you fix this for teh debugger, you implicitly fix it for all the other tools.
I'm not entering into that world. Beauty is in the eye of the beholder. I'm sure someone thinks its lovely...and btw: spidermonkey API is sooooo ugly... %-(
Stephen