Re: [WSG] JavaScript clarification please
Anthony wrote: My sentiments exactly. On 27/10/2008, at 3:46 PM, Breton Slivka [EMAIL PROTECTED] wrote: I'm afraid I will have to throw up my hands and give up on you. You are a lost cause. you cannot be reached. Oh, good. Can we return the list to web standards now? *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***
Re: [WSG] Re: Searching for standards information
On Mon, Oct 27, 2008 at 8:58 AM, Webb, KerryA [EMAIL PROTECTED]wrote: A brief addition to this: starting next January, anyone (not just HREOC/AHRC) will have the right to take an action to their state/territory Supreme Court if they feel that they've been discriminated against. Kerry Interesting times, indeed. Without going too far off-topic, I am wondering how active some groups will be who are not entirely pleased with Australia's current policies relating to immigration, defence, fiscal and water policy. Assuming that these folk have friends who may have a case that is worth pushing. What will that mean to those of us who may have advised on accessibility for government clients in the past? Cheers, Andrew -- --- Andrew Boyd http://onblogging.com.au *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***
Re: [WSG] JavaScript clarification please
Yes. But, one final question. Was the *first ever* implementation of JavaScript designed to be object-oriented, object-based, or prototype-based? Thank you all. Oh and to David and Christian, in regards to the w3schools, I reread parts of their site, and I understand now what you mean. My apologies. :) Thanks again, Brett On Mon, Oct 27, 2008 at 1:59 AM, Mark Harris [EMAIL PROTECTED] wrote: Anthony wrote: My sentiments exactly. On 27/10/2008, at 3:46 PM, Breton Slivka [EMAIL PROTECTED] wrote: I'm afraid I will have to throw up my hands and give up on you. You are a lost cause. you cannot be reached. Oh, good. Can we return the list to web standards now? *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] *** *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***
Re: [WSG] JavaScript clarification please
2008/10/27 Brett Patterson [EMAIL PROTECTED]: Yes. But, one final question. Was the first ever implementation of JavaScript designed to be object-oriented, object-based, or prototype-based? Thank you all. The first implementation of JavaScript is still alive in the form of Mozilla SpiredMonkey, even though much of it has been changed since then. It was designed to be object oriented through usage of the prototypal inheritance scheme, so it's pretty much all three at once. Since everything in JavaScript is an object, it can be said to be object based as well as object oriented. Anthony Ziebell's argument that it's prototype-based rather than object oriented is a false dichotomy since prototypal inheritance is in fact one of the ways to achieve objevt orientation. As such, a system can become object oriented as a result of adding prototypal inheritance to an object based system. Anthony Ziebell is arguing that it's not object oriented based on the false premise that classical inheritance is the way to achieve object orientation and prototypal inheritance is not, despite himself linking articles stating the contrary. -- David liorean Andersson *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***
Re: [WSG] JavaScript clarification please
2008/10/27 liorean [EMAIL PROTECTED]: The first implementation of JavaScript is still alive in the form of Mozilla SpiredMonkey Or SpiderMonkey, as it is properly called :) -- David liorean Andersson *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***
Re: [WSG] JavaScript clarification please
My statement was not worded correctly. I use Java, C++, PHP and Javascript and I can tell you that out of the lot of them, Javascript is the most difficult to incorperate conventional Object Orientated design. For example you cannot simply define classes, or use visability keywords (you can do it, but not the conventional way) and some of the OOP design patterns are difficult to put into Javascript. I have the Apress book on Javascript Design Patterns, which helped alot when learning OOP in JS. Sorry my wording was wrong. I think the above is what I meant. *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***
Re: [WSG] JavaScript clarification please
Not exactly. My arguement was that while javascript has objects, it is indeed prototype-based It is only through arguement did any mention of javascripts inheritence get a mention, which is also still true. This was not the underlying factor, but something somone brought up. I'm not sure why it is so bad that javascript be prototype-based? I have said again and again that it still does have objects, sighted many sources which state javascript as a prototype-based language and other examples for the arguement along the way... It is still a good language and there is nothing negative about prototype? Anyway I only respond again because I don't like to be miss- represented. If you still feel I am wrong and disprove of the wiki articles stating it is prototype-based, you really should edit them as it must be a miss-representation of javascript. Regards, Anthony. Sent from my iPhone! On 28/10/2008, at 12:43 AM, liorean [EMAIL PROTECTED] wrote: 2008/10/27 Brett Patterson [EMAIL PROTECTED]: Yes. But, one final question. Was the first ever implementation of JavaScript designed to be object-oriented, object-based, or prototype-based? Thank you all. The first implementation of JavaScript is still alive in the form of Mozilla SpiredMonkey, even though much of it has been changed since then. It was designed to be object oriented through usage of the prototypal inheritance scheme, so it's pretty much all three at once. Since everything in JavaScript is an object, it can be said to be object based as well as object oriented. Anthony Ziebell's argument that it's prototype-based rather than object oriented is a false dichotomy since prototypal inheritance is in fact one of the ways to achieve objevt orientation. As such, a system can become object oriented as a result of adding prototypal inheritance to an object based system. Anthony Ziebell is arguing that it's not object oriented based on the false premise that classical inheritance is the way to achieve object orientation and prototypal inheritance is not, despite himself linking articles stating the contrary. -- David liorean Andersson *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] *** *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***
Re: [WSG] JavaScript clarification please
2008/10/27 Anthony [EMAIL PROTECTED]: My arguement was that while javascript has objects, it is indeed prototype-based Oh, we're not disputing that. But look at some of your earlier comments. This for instance: 2008/10/24 Anthony Ziebell [EMAIL PROTECTED]: Sure, that's what an object is. But OOP is not just about an object. There is a lot more involved. Don't get me wrong, I am a fan of JavaScript - but it has faux classes and objects, and this is why my opinion of JavaScript is that it is prototype, not object. First of all I'm assuming you meaning object-based and prototype-based there, because the sentence as written just does not make sense. Anyway, it's a false dichotomy because JavaScript is object-based AND prototype-based. It's also object oriented. Also, while you can say it's got faux classes (it actually has in the ECMAScript specification, but nothing author accessible) those classes have no greater importance to the author as they are not available to user JavaScript. Here's another such statement of yours: 2008/10/24 Anthony Ziebell [EMAIL PROTECTED]: Forgot to clarify one thing: ECMAScript is fully OO in my opinion, however JavaScript is not a full implementation of ECMAScript, unfortunately. This sounds like you're insinuating that while ECMAScript is fully object oriented, JavaScript is not. That's just plain false. Another one: 2008/10/27 Anthony Ziebell [EMAIL PROTECTED]: There is a difference between the use of object and object-oriented programming. Coad / Yourdon suggests object-oriented being classes and objects, inheritance and communication with messages. Does JavaScript have classes? Not user classes, no. Only implementation/host. Can inheritance of JavaScript occur without prototype? Not automatically, no. Why would it need another inheritance mechanism in order to be object oriented? [snip] Object-oriented programming consists of native inheritance. Are you suggesting that a prototypical approach to inheritance one in the same as native inheritance? Do you mean native as in the implementation language (machine native, if you will) or native as in user JavaScript? Anyway, the inheritance mechanism in JavaScript is prototype delegation, and it certainly is the native method of inheritance for JavaScript. It may or may not be the method of inheritance for host objects, but that's another story. 2008/10/27 Anthony [EMAIL PROTECTED]: It is only through arguement did any mention of javascripts inheritence get a mention, which is also still true. This was not the underlying factor, but something somone brought up. It's the core part of being a prototype-based language, so even if you've not mentioned inheritance you've certainly talked about it. But you have at several occasions mentioned inheritance, so that's beyond the point. I'm not sure why it is so bad that javascript be prototype-based? I have said again and again that it still does have objects, sighted many sources which state javascript as a prototype-based language and other examples for the arguement along the way... It is still a good language and there is nothing negative about prototype? We're not arguing about that. We're arguing that it being prototype-based is the very factor that makes it object oriented. But you on the other hand have at least seemingly argued that it is not object oriented, which is the point we've been addressing all along. Anyway I only respond again because I don't like to be miss-represented. If you still feel I am wrong and disprove of the wiki articles stating it is prototype-based, you really should edit them as it must be a miss-representation of javascript. We're not arguing against the articles. We've been arguing constantly throughout this thread that JavaScript may be prototype-based, but that does not make it any less object oriented. And I don't think I'm missrepresenting you at all when I say you've argued against that point. -- David liorean Andersson *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***
Re: [WSG] JavaScript clarification please
Not once did I hear someone say it was prototype-based. Intact others have flat out denied it. The question was is it either object or prototype. I merely stated if anything it should be seen as prototype, but it does have objects. Then, it followed with all sorts of garbage from those trying to debunk the notion of javascript being prototype. Not once did I say it does not have objects. Intact I offered that it does. Regards, Anthony. Sent from my iPhone! On 28/10/2008, at 7:40 AM, liorean [EMAIL PROTECTED] wrote: 2008/10/27 Anthony [EMAIL PROTECTED]: My arguement was that while javascript has objects, it is indeed prototype-based Oh, we're not disputing that. But look at some of your earlier comments. This for instance: 2008/10/24 Anthony Ziebell [EMAIL PROTECTED]: Sure, that's what an object is. But OOP is not just about an object. There is a lot more involved. Don't get me wrong, I am a fan of JavaScript - but it has faux classes and objects, and this is why my opinion of JavaScript is that it is prototype, not object. First of all I'm assuming you meaning object-based and prototype-based there, because the sentence as written just does not make sense. Anyway, it's a false dichotomy because JavaScript is object-based AND prototype-based. It's also object oriented. Also, while you can say it's got faux classes (it actually has in the ECMAScript specification, but nothing author accessible) those classes have no greater importance to the author as they are not available to user JavaScript. Here's another such statement of yours: 2008/10/24 Anthony Ziebell [EMAIL PROTECTED]: Forgot to clarify one thing: ECMAScript is fully OO in my opinion, however JavaScript is not a full implementation of ECMAScript, unfortunately. This sounds like you're insinuating that while ECMAScript is fully object oriented, JavaScript is not. That's just plain false. Another one: 2008/10/27 Anthony Ziebell [EMAIL PROTECTED]: There is a difference between the use of object and object-oriented programming. Coad / Yourdon suggests object-oriented being classes and objects, inheritance and communication with messages. Does JavaScript have classes? Not user classes, no. Only implementation/host. Can inheritance of JavaScript occur without prototype? Not automatically, no. Why would it need another inheritance mechanism in order to be object oriented? [snip] Object-oriented programming consists of native inheritance. Are you suggesting that a prototypical approach to inheritance one in the same as native inheritance? Do you mean native as in the implementation language (machine native, if you will) or native as in user JavaScript? Anyway, the inheritance mechanism in JavaScript is prototype delegation, and it certainly is the native method of inheritance for JavaScript. It may or may not be the method of inheritance for host objects, but that's another story. 2008/10/27 Anthony [EMAIL PROTECTED]: It is only through arguement did any mention of javascripts inheritence get a mention, which is also still true. This was not the underlying factor, but something somone brought up. It's the core part of being a prototype-based language, so even if you've not mentioned inheritance you've certainly talked about it. But you have at several occasions mentioned inheritance, so that's beyond the point. I'm not sure why it is so bad that javascript be prototype-based? I have said again and again that it still does have objects, sighted many sources which state javascript as a prototype-based language and other examples for the arguement along the way... It is still a good language and there is nothing negative about prototype? We're not arguing about that. We're arguing that it being prototype-based is the very factor that makes it object oriented. But you on the other hand have at least seemingly argued that it is not object oriented, which is the point we've been addressing all along. Anyway I only respond again because I don't like to be miss- represented. If you still feel I am wrong and disprove of the wiki articles stating it is prototype-based, you really should edit them as it must be a miss-representation of javascript. We're not arguing against the articles. We've been arguing constantly throughout this thread that JavaScript may be prototype-based, but that does not make it any less object oriented. And I don't think I'm missrepresenting you at all when I say you've argued against that point. -- David liorean Andersson *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] *** *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Re: [WSG] JavaScript clarification please
It is my understanding that the bulk of those OOP design patterns are useful to get around the limitations of static languages like C++ and Java, that don't allow you to arbitrarily add/remove properties from instances, change the type of a value, or allow higher order functions (functions that return functions values), or allow you to pass in functions as values. Given that javascript allows all those things, much of those traditional OOP design patterns don't make much sense, because they're getting around a limitation that doesn't exist. I haven't extensively used the OOP facilities in PHP, I've always found the syntax to be ugly as hell, I could never bring myself to type that crap willingly. So unfortunately, I cannot speak knowledgably about how difficult or hard it is in PHP. On Tue, Oct 28, 2008 at 1:17 AM, James Jeffery [EMAIL PROTECTED] wrote: My statement was not worded correctly. I use Java, C++, PHP and Javascript and I can tell you that out of the lot of them, Javascript is the most difficult to incorperate conventional Object Orientated design. For example you cannot simply define classes, or use visability keywords (you can do it, but not the conventional way) and some of the OOP design patterns are difficult to put into Javascript. I have the Apress book on Javascript Design Patterns, which helped alot when learning OOP in JS. Sorry my wording was wrong. I think the above is what I meant. *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] *** *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***
Re: [WSG] JavaScript clarification please
Brett Patterson skrev: I am in the middle of a conversation with this guy who says that JavaScript is an object-oriented language. Is he correct? Could you please site some references? I have read the whole thread up until now, but will answer your starting message, since I am not addressing a single specific respondent. I am in charge of developing DOM Scripting courses for the Curriculum Framework of the WaSP Education Task Force[1] I have therefore tried to read every single resource about JavaScript, ECMAScript and the DOM that has been written from a computer science perspective. There are not that many, which might be a reason behind the confusion. Anyway: JavaScript (a term owned by Sun, licensed to Mozilla, and used by all browser vendors but Microsoft) is in all essence, as Liorean has stated, a superset of ECMAScript 3.0. That is also the sentiment of Brendan Eich - and should therefore be taken as a final word. (Anthony was indeed wrong about this.) JScript as implemented in Internet Explorer is roughly equivalent, but deviates in some small ways. JavaScript is a mix of Self, Scheme and C (according to the ECMAScript 3.1 draft, the love child between Scheme and C according to Brendan Eich). JavaScript is indeed Object Oriented, but even though every script is run within a host object - usually the window object of a browser - a procedural style is possible to use. 90's DHTML scripts were usually procedural and used document.write (which is not ECMAScript but part of the DOM) in a way that reminds me of *standard streams*, which could be provided by the host object, but usually aren't. Public, private and protected methods and properties are not easily implemented. Object Oriented design patterns (singletons, factories, registry, adaptors...) can usually be emulated. Sometimes this is only done through considerable wizardry using concepts like lambda and closures. ECMAScript 4.0 aka JavaScript 2.0 was supposed to get a limited class based inheritance mechanism to *complement* the prototype based one we use today. Those plans have been halted. ECMAScript Harmony will most probably *not* get any class based inheritance. (At least two JavaScript engines (V8 and Squirrelfish Extreme) emulate class based object creation as part of their just in time compilation, but that really is a compiler issue.) ECMASCript 3.1 will get a few new methods to facilitate easier inheritance patterns. E.g. Object.freeze(). Many popular libraries also have methods that facilitate OO-patterns. As old school cut' n' paste coding is getting superseded by libraries procedural code is becoming less seen and OO-style coding is getting more used. Indeed, using object chaining in JQuery et al, the programming is even well on its way to become *declarative*. Summary: 1. JavaScript *is* OO. 2. JavaScript uses a prototypal - class-less - inheritance mechanism. 3. Anyone writing a script can use procedural style, OO-style or even make forays into a declarative style. Nit picking on some stuff in the thread: JavaScript has no pure hash-tables, aka associative arrays. Object properties can be used to emulate associative arrays, though. A PHP programmer will feel very limited, though. A JavaScript object *is* not an array (once again Anthony got it wrong). It can have methods as well as properties. asideArrays are however objects, and confusingly typeof [ 1, 2 ] evalutes to object, not array. A major design flaw. The best known way to test for an array is: Object.prototype.toString.apply(value) === '[object Array]' Discovered by Mark Miller of Google./aside From a very strict computer science point of view averything in JavaScript is *not* an object. (No matter how much Alex Dojo Russel et al. reiterates that mantra.) In practice everything is. JavaScript has got a few primitives (numbers, strings, booleans, undefined). Whenever a primitive is referenced with an OO-syntax it is converted into its corresponding wrapper object. This was modeled after Java according to Brendan, and he has stated that it probably was a bad idea. (Search the ES4 mailing list for a reference.) Lars Gunther Sources: MDC, including https://developer.mozilla.org/En/About_JavaScript ES 3.0 spec ES 3.1 spec draft JavaScript, The Definitive Guide (latest edition) ES3.1 mailing list ES 4/Harmony mailing list Doug Crockfords site and book (JavaScript, the good parts) Numerous other JavaScript books 1. http://www.webstandards.org/2008/07/31/announcing-the-wasp-curriculum-framework/ *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***
[WSG] how come
hi, How come you cant change the list-type from none to circle(or anything else) on li a:hover? -kevin *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***
Re: [WSG] JavaScript clarification please
On Mon, Oct 27, 2008 at 11:00 PM, Brett Patterson [EMAIL PROTECTED] wrote: Yes. But, one final question. Was the first ever implementation of JavaScript designed to be object-oriented, object-based, or prototype-based? Thank you all. Here is Brenden Eich, Javascript's creator, pontificating on the history and genesis of javascript http://weblogs.mozillazine.org/roadmap/archives/2008/04/popularity.html#more Quote: I'm not proud, but I'm happy that I chose Scheme-ish first-class functions and Self-ish (albeit singular) prototypes as the main ingredients. So in short, Yes, it was object oriented, with prototype-based inheritence, first class scheme like functions, and (thanks to netscape management) Java like syntax right from the start. *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***
Re: [WSG] how come
Hi Kevin, The list-style-type (I assume that's what you meant) sets the list-item marker. So giving the anchor a list-style-type wouldn't effect the list-item. Cheers, Anthony. kevin mcmonagle wrote: hi, How come you cant change the list-type from none to circle(or anything else) on li a:hover? -kevin *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] *** ***List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfmUnsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfmHelp: [EMAIL PROTECTED]***
Re: [WSG] JavaScript clarification please
Hey Breton, I think the examples you gave are implemented in the PHP object and are relatively simple to implement. Cheers, Anthony. Breton Slivka wrote: It is my understanding that the bulk of those OOP design patterns are useful to get around the limitations of static languages like C++ and Java, that don't allow you to arbitrarily add/remove properties from instances, change the type of a value, or allow higher order functions (functions that return functions values), or allow you to pass in functions as values. Given that _javascript_ allows all those things, much of those traditional OOP design patterns don't make much sense, because they're getting around a limitation that doesn't exist. I haven't extensively used the OOP facilities in PHP, I've always found the syntax to be ugly as hell, I could never bring myself to type that crap willingly. So unfortunately, I cannot speak knowledgably about how difficult or hard it is in PHP. On Tue, Oct 28, 2008 at 1:17 AM, James Jeffery [EMAIL PROTECTED] wrote: My statement was not worded correctly. I use Java, C++, PHP and _javascript_ and I can tell you that out of the lot of them, _javascript_ is the most difficult to incorperate conventional Object Orientated design. For example you cannot simply define classes, or use visability keywords (you can do it, but not the conventional way) and some of the OOP design patterns are difficult to put into _javascript_. I have the Apress book on _javascript_ Design Patterns, which helped alot when learning OOP in JS. Sorry my wording was wrong. I think the above is what I meant. *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] *** *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] *** ***List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfmUnsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfmHelp: [EMAIL PROTECTED]***
Re: [WSG] JavaScript clarification please
Thanks Keryx, Some interesting information. Nice point on the arrays actually being objects. At one point you did mention _javascript_ is object-based, then in another, prototype-based. So that confuses me a little. If your point is that it is object-based and uses prototype to inherit objects, I think I understand your point. Still confuses me though - if someone is object-orientated but is in essence prototype-based (with regards to object, inheritance, etc), why is it incorrect to say _javascript_ is prototype-based? Cheers, Anthony. Keryx Web wrote: Brett Patterson skrev: I am in the middle of a conversation with this guy who says that _javascript_ is an object-oriented language. Is he correct? Could you please site some references? I have read the whole thread up until now, but will answer your starting message, since I am not addressing a single specific respondent. I am in charge of developing DOM Scripting courses for the Curriculum Framework of the WaSP Education Task Force[1] I have therefore tried to read every single resource about _javascript_, ECMAScript and the DOM that has been written from a computer science perspective. There are not that many, which might be a reason behind the confusion. Anyway: _javascript_ (a term owned by Sun, licensed to Mozilla, and used by all browser vendors but Microsoft) is in all essence, as Liorean has stated, a superset of ECMAScript 3.0. That is also the sentiment of Brendan Eich - and should therefore be taken as a final word. (Anthony was indeed wrong about this.) JScript as implemented in Internet Explorer is roughly equivalent, but deviates in some small ways. _javascript_ is a mix of Self, Scheme and C (according to the ECMAScript 3.1 draft, the "love child between Scheme and C" according to Brendan Eich). _javascript_ is indeed Object Oriented, but even though every script is run within a host object - usually the window object of a browser - a procedural style is possible to use. 90's DHTML scripts were usually procedural and used document.write (which is not ECMAScript but part of the DOM) in a way that reminds me of *standard streams*, which could be provided by the host object, but usually aren't. Public, private and protected methods and properties are not easily implemented. Object Oriented design patterns (singletons, factories, registry, adaptors...) can usually be emulated. Sometimes this is only done through considerable wizardry using concepts like lambda and closures. ECMAScript 4.0 aka _javascript_ 2.0 was supposed to get a limited class based inheritance mechanism to *complement* the prototype based one we use today. Those plans have been halted. ECMAScript "Harmony" will most probably *not* get any class based inheritance. (At least two _javascript_ engines (V8 and Squirrelfish Extreme) emulate class based object creation as part of their just in time compilation, but that really is a compiler issue.) ECMASCript 3.1 will get a few new methods to facilitate easier inheritance patterns. E.g. Object.freeze(). Many popular libraries also have methods that facilitate OO-patterns. As old school cut' n' paste coding is getting superseded by libraries procedural code is becoming less seen and OO-style coding is getting more used. Indeed, using object chaining in JQuery et al, the programming is even well on its way to become *declarative*. Summary: 1. _javascript_ *is* OO. 2. _javascript_ uses a prototypal - class-less - inheritance mechanism. 3. Anyone writing a script can use procedural style, OO-style or even make forays into a declarative style. Nit picking on some stuff in the thread: _javascript_ has no pure hash-tables, aka associative arrays. Object properties can be used to emulate associative arrays, though. A PHP programmer will feel very limited, though. A _javascript_ object *is* not an array (once again Anthony got it wrong). It can have methods as well as properties. asideArrays are however objects, and confusingly typeof [ 1, 2 ] evalutes to "object", not "array". A major design flaw. The best known way to test for an array is: Object.prototype.toString.apply(value) === '[object Array]' Discovered by Mark Miller of Google./aside >From a very strict computer science point of view averything in _javascript_ is *not* an object. (No matter how much Alex "Dojo" Russel et al. reiterates that mantra.) In practice everything is. _javascript_ has got a few "primitives" (numbers, strings, booleans, undefined). Whenever a primitive is referenced with an OO-syntax it is converted into its corresponding wrapper object. This was modeled after Java according to Brendan, and he has stated that it probably was a bad idea. (Search the ES4 mailing list for a reference.) Lars Gunther Sources: MDC, including https://developer.mozilla.org/En/About_JavaScript ES 3.0 spec
Re: [WSG] how come
The list-style appears on the li element. The selector li a:hover matches the a element, which isn't display: list-item and so can't have a list marker. Additionally, CSS provides no way to select an element based on its children, so you can't match the list item based on the hover state of a link inside it. You could match li:hover, but that won't work in IE7 in Quirks mode or IE6 at all. Thanks, so its actually on a separate element in this case.. well that explains it. and sorry bout that everyone I was unaware that my email client did that. *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***
Re: [WSG] JavaScript clarification please
2008/10/27 Anthony [EMAIL PROTECTED]: Not once did I hear someone say it was prototype-based. Intact others have flat out denied it. The question was is it either object or prototype. I merely stated if anything it should be seen as prototype, but it does have objects. Now you're doing that again. What do you mean when you say is it either object or prototype? Because the sentence as you write it is nonsensical. If you mean object-based and prototype-based respectively, then say that. If you mean object oriented, then say that. If you mean that it has objects, then say that. But saying javascript is object or javascript is prototype is nonsensical. For the record, pretty much everyone has said either that it uses prototypal inheritance - which means the same thing as saying it's prototype-based - or have said that it is prototype-based. Then, it followed with all sorts of garbage from those trying to debunk the notion of javascript being prototype. Not once did I say it does not have objects. Intact I offered that it does. it has objects does not mean the same as object oriented. It doesn't even mean the same as object-based. You've argued that it's prototype-based rather than object oriented, and every time we've said that it's both you've argued against us. We have not debunked that it's prototype-based, in fact we've brought up the fact it has prototypal inheritance and this is one of the mechanisms that makes it object oriented several times. -- David liorean Andersson *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***
Re: [WSG] JavaScript clarification please
Anthony Ziebell skrev: Still confuses me though - if someone is object-orientated but is in essence prototype-based (with regards to object, inheritance, etc), why is it incorrect to say JavaScript is prototype-based? Your confusion comes from comparing apples to steam trains. Prototypes are an inheritance mechanism for objects. Classes are another inheritance mechanism. A language may implement either one or both (very rare). It does not matter which inheritance mechanism that is used. It is still an OO language. It is *not* incorrect to say JavaScript is prototype based. It is. No one is denying it. It is *not* incorrect to say JavaScript is OO. It is, since OO is a paradigm for programming which JS fits very neatly in. It is de facto called OO in the ECMAScript spec. It is *not* incorrect to say JavaScript is object based. It is - since it has object wrappers for all primitive values. You really did seem to say that classes are needed for a language to be called OO. Now you have stated that you did not intend to say that. Case closed. Lars Gunther *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***
Re: [WSG] JavaScript clarification please
Ok, great. It was my intent to acknowledge some standards / submissions for OO which inferred classes / native inheritance were needed. Thanks for your help :) Cheers, Anthony. Keryx Web wrote: Anthony Ziebell skrev: Still confuses me though - if someone is object-orientated but is in essence prototype-based (with regards to object, inheritance, etc), why is it incorrect to say _javascript_ is prototype-based? Your confusion comes from comparing apples to steam trains. Prototypes are an inheritance mechanism for objects. Classes are another inheritance mechanism. A language may implement either one or both (very rare). It does not matter which inheritance mechanism that is used. It is still an OO language. It is *not* incorrect to say _javascript_ is prototype based. It is. No one is denying it. It is *not* incorrect to say _javascript_ is OO. It is, since OO is a paradigm for programming which JS fits very neatly in. It is de facto called OO in the ECMAScript spec. It is *not* incorrect to say _javascript_ is object based. It is - since it has object wrappers for all primitive values. You really did seem to say that classes are needed for a language to be called OO. Now you have stated that you did not intend to say that. Case closed. Lars Gunther *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] *** ***List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfmUnsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfmHelp: [EMAIL PROTECTED]***
[WSG] Javascript classical inheritence [was: JavaScript clarification please]
All this talk over JavaScript not supporting classes, is incorrect. I put together a little demo of classical class-based inheritence. The only real limitation is that you can't do protected members and friends and the syntax might be considered to be a little clunky. http://members.optusnet.com.au/~mathew/js/ I hope this helps clear things up a bit. Mathew Robertson *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***
Re: [WSG] Javascript classical inheritence [was: JavaScript clarification please]
2008/10/28 Mathew Robertson [EMAIL PROTECTED]: All this talk over JavaScript not supporting classes, is incorrect. I put together a little demo of classical class-based inheritence. The only real limitation is that you can't do protected members and friends and the syntax might be considered to be a little clunky. http://members.optusnet.com.au/~mathew/js/ I hope this helps clear things up a bit. That's support for classes in the same way C has support for classes though - you can design them on top of the language, but you don't get support for it for ordinary language elements or for built in operators. You're still not getting around that there's no built in support for classical inheritance, other than the pseudo-classes that are used in the ECMAScript spec internally but not for language for us users. -- David liorean Andersson *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***
Re: [WSG] Javascript classical inheritence
http://members.optusnet.com.au/~mathew/js/ I hope this helps clear things up a bit. That's support for classes in the same way C has support for classes though - you can design them on top of the language, but you don't get support for it for ordinary language elements or for built in operators. I'm not sure what ordinary language elements means... C cant do this (but the example page can): some_type o = new some_type(); bool result = o.some_method(); where some_method is from a base-class. C could do this: some_type o = some_type_constructor(); bool result = some_method(o); but then some_method would require the developer to somehow first cast down the inheritence chain, then fallback when nothing is found (all of which is automatically done for you in class-based OOP languages). So, if the example page isn't OOP using class-based inheritence, I'm not sure what is Operator overloading is a feature of some languages - Java doesn't have it, so why is there an expectation that javascript should have it? Also, I'm not sure what you mean by no support for built in operators, since new blah(...) is supported by javascript (aka 'new' is an operator). You're still not getting around that there's no built in support for classical inheritance, other than the pseudo-classes that are used in the ECMAScript spec internally but not for language for us users. The internals of ECMAScript are irrelevant - it doesn't matter *how* I do it - and it doesn't matter if they are psuedo classes or not - it only matters that I can indeed create my own application specific class heirarchies. And as it turns out, the syntax isn't too crap either, ie: we have effectively created the Class keyword: var NewType = Class(NewType,{ /* implementation */}, BaseType); var o = new NewType(...); And we can even access the baseclass methods independently: o.some_method(); o.SUPER.some_method(); What else do us users need? Mathew Robertson *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***
Re: [WSG] JavaScript clarification please
I am sorry, but I must ask. Are you saying that the term JavaScript is owned by Sun? Or just the Java part? And, yes, JavaScript is implemented in Internet Explorer. On Mon, Oct 27, 2008 at 6:18 PM, Anthony Ziebell [EMAIL PROTECTED] wrote: Ok, great. It was my intent to acknowledge some standards / submissions for OO which inferred classes / native inheritance were needed. Thanks for your help :) Cheers, Anthony. Keryx Web wrote: Anthony Ziebell skrev: Still confuses me though - if someone is object-orientated but is in essence prototype-based (with regards to object, inheritance, etc), why is it incorrect to say JavaScript is prototype-based? Your confusion comes from comparing apples to steam trains. Prototypes are an inheritance mechanism for objects. Classes are another inheritance mechanism. A language may implement either one or both (very rare). It does not matter which inheritance mechanism that is used. It is still an OO language. It is *not* incorrect to say JavaScript is prototype based. It is. No one is denying it. It is *not* incorrect to say JavaScript is OO. It is, since OO is a paradigm for programming which JS fits very neatly in. It is de facto called OO in the ECMAScript spec. It is *not* incorrect to say JavaScript is object based. It is - since it has object wrappers for all primitive values. You really did seem to say that classes are needed for a language to be called OO. Now you have stated that you did not intend to say that. Case closed. Lars Gunther *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] *** *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] *** *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***
Re: [WSG] how come
Have you tried: ul li:hover { list-style-type: circle; } On Mon, Oct 27, 2008 at 6:04 PM, kevin mcmonagle [EMAIL PROTECTED] wrote: The list-style appears on the li element. The selector li a:hover matches the a element, which isn't display: list-item and so can't have a list marker. Additionally, CSS provides no way to select an element based on its children, so you can't match the list item based on the hover state of a link inside it. You could match li:hover, but that won't work in IE7 in Quirks mode or IE6 at all. Thanks, so its actually on a separate element in this case.. well that explains it. and sorry bout that everyone I was unaware that my email client did that. *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] *** *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***
Re: [WSG] JavaScript clarification please
2008/10/28 Brett Patterson [EMAIL PROTECTED]: I am sorry, but I must ask. Are you saying that the term JavaScript is owned by Sun? Or just the Java part? And, yes, JavaScript is implemented in Internet Explorer. Yes, it's a registred trademark of Sun, licenced to Netscape once upon a time as part of a marketing deal including bundling the Java runtime with Navigator. (Netscape had originally intended to use the name LiveScript.) And it would be more correct to say Microsoft implements ECMAScript than to say they implement JavaScript. They do not implement most of the Netscape/Mozilla JavaScript additions to ECMAScript. The name JavaScript is very seldom used by Microsoft. If you read Microsoft employee blogs and official statements, you almost never encounter that term. They prefer to either use their own JScript name or the ECMAScript name. -- David liorean Andersson *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***
Re: [WSG] JavaScript clarification please
The term Javascript is indeed owned by Sun. The implementation of Ecmascript in IE is called JScript, not Javascript, so it doesn't infringe the trademark (technically, but it's similar enough that people can still easily think that IE calls it Javascript) On Tue, Oct 28, 2008 at 12:20 PM, Brett Patterson [EMAIL PROTECTED] wrote: I am sorry, but I must ask. Are you saying that the term JavaScript is owned by Sun? Or just the Java part? And, yes, JavaScript is implemented in Internet Explorer. On Mon, Oct 27, 2008 at 6:18 PM, Anthony Ziebell [EMAIL PROTECTED] wrote: Ok, great. It was my intent to acknowledge some standards / submissions for OO which inferred classes / native inheritance were needed. Thanks for your help :) Cheers, Anthony. Keryx Web wrote: Anthony Ziebell skrev: Still confuses me though - if someone is object-orientated but is in essence prototype-based (with regards to object, inheritance, etc), why is it incorrect to say JavaScript is prototype-based? Your confusion comes from comparing apples to steam trains. Prototypes are an inheritance mechanism for objects. Classes are another inheritance mechanism. A language may implement either one or both (very rare). It does not matter which inheritance mechanism that is used. It is still an OO language. It is *not* incorrect to say JavaScript is prototype based. It is. No one is denying it. It is *not* incorrect to say JavaScript is OO. It is, since OO is a paradigm for programming which JS fits very neatly in. It is de facto called OO in the ECMAScript spec. It is *not* incorrect to say JavaScript is object based. It is - since it has object wrappers for all primitive values. You really did seem to say that classes are needed for a language to be called OO. Now you have stated that you did not intend to say that. Case closed. Lars Gunther *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] *** *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] *** *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] *** *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***
Re: [WSG] JavaScript clarification please
Brett Patterson wrote: I am sorry, but I must ask. Are you saying that the term JavaScript is owned by Sun? Yes, and googling javascript trademark gives a first hit of http://en.wikipedia.org/wiki/JavaScript And, yes, JavaScript is implemented in Internet Explorer. And, no, the same reference will explain why that's incorrect. FWIW, -- Hassan Schroeder - [EMAIL PROTECTED] Webtuitive Design === (+1) 408-621-3445 === http://webtuitive.com dream. code. *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***
Re: [WSG] JavaScript clarification please
2008/10/28 liorean [EMAIL PROTECTED]: Yes, it's a registred trademark of Sun, Actually a Trademark, not a Registred Trademark, apparently. -- David liorean Andersson *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***
Re: [WSG] JavaScript clarification please
liorean wrote: (Netscape had originally intended to use the name LiveScript.) Actually, it was initially released as LiveScript and renamed later. So much backstory on that, but at this point I have no idea what's covered by my then employment contract. Regardless, good times. :-) -- Hassan Schroeder - [EMAIL PROTECTED] Webtuitive Design === (+1) 408-621-3445 === http://webtuitive.com dream. code. *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***
[WSG] CSS and printing absolute units
I need to write a print style sheet and have a particular element on the page print at a specific absolute size (85mm by 35mm). I've set the size using the mm units in the style sheet, but the element is printing at 65mm wide. From what I can see, mm (and cm) are well supported measurements in different browsers, but the results I'm getting in print are not what I need. Does anyone have any advice on how I can get the area to print at the right size? Or am I doomed to failure due to different users printers probably giving different results anyway? *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***
[WSG] Proposed National Policy on Online Accessibility for India
Hello! As an independent accessibility consultant, I was heartened by India's ratification of the UN Convention on the Rights of Persons with Disabilities, and especially with Articles 9 and 21 (mandating online accessibility). However, over the last two years, little or no work has been done at a policy level - so I would like to propose a National Policy on Online Accessibility for India. At the moment, I'm trying to bring together the various different groups working on accessibility, as that would lend some weight to the project. I've put down some of my thoughts here: http://rahulgonsalves.com/e-access/ If you would like to support this effort - not financially - but merely by publicising it and becoming a part of this, I'd be most grateful. I look forward to hearing from you - suggestions, criticism and complaints are all welcome! Warmly, - Rahul Gonsalves. (apologies for cross-posting) - Rahul Gonsalves e: [EMAIL PROTECTED] w: www.rahulgonsalves.com m: +91 98866 19365 - *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***