I prefer the syntax from #1, it feels highly readable. couldn't extend
be protected?
#2 is ok, I could certainly live with it.
Shane
On 12-04-09 5:45 PM, Irakli Gozalishvili wrote:
> Hi Folks,
>
> We have being doing some work to make it easier to inherit (subclass)
> core components provided by an SDK like: Panel, Tab, Window� We have
> considered few alternative APIs, but before making a final decision I
> would like to also hear input from our
> community. Here are three APIs we do consider:
>
> https://gist.github.com/2321738
>
> Please vote by listing them in order of your preference!
>
> Also, be aware that this will be backwards compatible change so
> everything will work as it is today. It's just if you want to create
> SuperPanel out of SDK Panel you will have a way to do that.
>
> Thanks!
> --
> Irakli Gozalishvili
> Web: http://www.jeditoolkit.com/
>
> --
> You received this message because you are subscribed to the Google
> Groups "mozilla-labs-jetpack" group.
> To post to this group, send email to mozilla-la...@googlegroups.com.
> To unsubscribe from this group, send email to
> mozilla-labs-jet...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/mozilla-labs-jetpack?hl=en.
#2 and #3 have the benefit to be more explicit. You know immediatly that Type/extend-mix come from api-utils/something.
Whereas #1 can end up being less explicit, when someone do:
Panel.extend({ ... }); or exports.Panel = Symbiont.extend({ ... });
You will have to know somehow that Panel inherits (most likely indirectly) from Base and can be extended in that way.
I dislike usage of mix() in #1 and #3. It is error prone and less redeable than #2 and current version of base (different than #1).
It adds parentheses over very long objects definition, and you would really like to avoid such ones!
In #2, I don't see the value of having `prototype` AND `implements`, can't we just have one such attribute that can accept object or array ?
Otherwise, I was wondering if something changed in Base. In the current version, we have to do: Color.new(...), whereas you do just : Color(...). Is that an expected improvement ?
I'd go as first choice, either with a version of `extend` that would avoid usage of `mix`, or a `Type` version with a unique `prototype`/`implements` attribute. A second choice would be `Base` without `mix`.
But like Shane, I think I would be able to live with any of these options. As in deep of my heart, I'd just prefer using plain Prototype :)
On Tuesday, April 10, 2012 2:45:20 AM UTC+2, gozala wrote:Hi Folks,We have being doing some work to make it easier to inherit (subclass) core components provided by an SDK like: Panel, Tab, Window… We have considered few alternative APIs, but before making a final decision I would like to also hear input from ourcommunity. Here are three APIs we do consider:Please vote by listing them in order of your preference!Also, be aware that this will be backwards compatible change so everything will work as it is today. It's just if you want to create SuperPanel out of SDK Panel you will have a way to do that.
Thanks!
--
Irakli Gozalishvili
Web: http://www.jeditoolkit.com/
--
You received this message because you are subscribed to the Google Groups "mozilla-labs-jetpack" group.
To view this discussion on the web visit https://groups.google.com/d/msg/mozilla-labs-jetpack/-/MzVYzZtjlYMJ.
This is a great point you bring up. However, we have made a shift in
focus this year. If you read the beginning of the roadmap document:
https://wiki.mozilla.org/Jetpack/Roadmap - I tried to lay out some of
the reasons for this shift (though I should also add a section about
jetpack being the best option for extensibility of Firefox on new
platforms).
We are still trying to make sure that the SDK is easier to use than the
traditional XUL tools, but we also want to accommodate this shift in
focus - so not everything will fall into the simplicity that is web
development. Nonetheless, we do need voices, like yours, to help us
gauge this shift and whether we are going too far in complexity - so
thanks!
Dave Mason
> --
> You received this message because you are subscribed to the Google
> Groups "mozilla-labs-jetpack" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/mozilla-labs-jetpack/-/vQ0mplVeeVsJ.
function Base() {}
Base.prototype = {
baseFunction : function() {
}
}
function Subclass() {}
Subclass.prototype = {
subclassFunction : function() {
}
}
extend(Subclass, Base);
with:
/**
* Create a subtype
*/
function extend(child, supertype)
{
child.prototype.__proto__ = supertype.prototype;
}
/**
* Copy properties of |source| into |target|
*/
function mixInto(source, target)
{
for (var property in source)
{
if (typeof(target[property]) == "undefined" &&
// avoid execution of getters/setters
!source.__lookupGetter__(property) &&
!source.__lookupSetter__(property))
{
target[property] = source[property];
}
}
}
When selecting from the given choices:
1. base.extend
3. extend-and-mix (close up)
I really dislike 2. declarative, because I have to set .prototype
explicitly (and it's not declarative, FWIW)
> Also, be aware that this will be backwards compatible change so
> everything will work as it is today. It's just if you want to create
> SuperPanel out of SDK Panel you will have a way to do that.
Good. It's important for me that I don't have to reformat my code in
order to use it in Jetpack. If I had to use this type system for my own
code, I would have to reformat a lot.
Ben
But I do agree with you that converting trad devs is one of the right
first steps. At the same time we also must keep some of our current
development focus on supporting mobile firefox which, in turn, helps us
keep an eye on the future. That future is likely to be one where we are
supporting multiple platforms where XUL is not present - thus, being
able to support traditional devs becomes even more important.
Having said all that, I do feel its important for us to always keep the
"web development" model in mind - where we can. The SDK should be easy
to use, be a similar experience to developing for the web, and have a
small "code footprint" so that its easy for people to contribute.
Dave
On Fri 13 Apr 2012 11:17:56 AM EDT, Erik Vold wrote:
> fwiw I don't think we should be communicating that we are changing
> focus, the focus on web/new developers shouldn't be reduced, but the
> strategy for attracting them should change. I think focusing on
> converting traditional addon devs (aka deep integrators) is the right
> first step for a new strategy though.
>
> E
>
> On Thu, Apr 12, 2012 at 11:27, David Mason <d...@mozilla.com
> <mailto:d...@mozilla.com>> wrote:
>
> Hi David,
>
> This is a great point you bring up. However, we have made a shift
> in focus this year. If you read the beginning of the roadmap
> document: https://wiki.mozilla.org/__Jetpack/Roadmap
> <https://wiki.mozilla.org/Jetpack/Roadmap> - I tried to lay out
> some of the reasons for this shift (though I should also add a
> section about jetpack being the best option for extensibility of
> Firefox on new platforms).
>
> We are still trying to make sure that the SDK is easier to use
> than the traditional XUL tools, but we also want to accommodate
> this shift in focus - so not everything will fall into the
> simplicity that is web development. Nonetheless, we do need
> voices, like yours, to help us gauge this shift and whether we are
> going too far in complexity - so thanks!
>
> --
> You received this message because you are subscribed to the Google
> Groups "mozilla-labs-jetpack" group.
To unsubscribe from this group, send email to
--
You received this message because you are subscribed to the Google Groups "mozilla-labs-jetpack" group.
To post to this group, send email to mozilla-labs-jetpack@googlegroups.com.
To unsubscribe from this group, send email to mozilla-labs-jetpack+unsub...@googlegroups.com.
+1 from this web developer dabbling in FF add-ons.
But I am probably not the ("deep integrator") target audience for this
functionality. That said and FWIW, I like the sound of "plain & simple"
(#3) over "Backbone like" or "Moo Tools like," but I will gladly defer
to those who know how to evaluate these things!
Cheers,
-Paul
--You received this message because you are subscribed to the Google Groups "mozilla-labs-jetpack" group.
To post to this group, send email to mozilla-la...@googlegroups.com.To unsubscribe from this group, send email to mozilla-labs-jet...@googlegroups.com.
On Friday, 2012-04-13 at 07:25 , Ben Bucksch wrote:
On 10.04.2012 02:45, Irakli Gozalishvili wrote:Please vote by listing them in order of your preference!When selecting from the given choices:1. base.extend3. extend-and-mix (close up)I really dislike 2. declarative, because I have to set .prototypeexplicitly (and it's not declarative, FWIW)
Also, be aware that this will be backwards compatible change soeverything will work as it is today. It's just if you want to createSuperPanel out of SDK Panel you will have a way to do that.Good. It's important for me that I don't have to reformat my code inorder to use it in Jetpack. If I had to use this type system for my owncode, I would have to reformat a lot.
Ben
On Friday, 2012-04-13 at 07:16 , Ben Bucksch wrote:
I use:function Base() {}Base.prototype = {baseFunction : function() {}}function Subclass() {}Subclass.prototype = {subclassFunction : function() {}}extend(Subclass, Base);with:/*** Create a subtype*/function extend(child, supertype){child.prototype.__proto__ = supertype.prototype;}
/*** Copy properties of |source| into |target|*/function mixInto(source, target){for (var property in source){if (typeof(target[property]) == "undefined" &&// avoid execution of getters/setters!source.__lookupGetter__(property) &&!source.__lookupSetter__(property)){target[property] = source[property];}}}
Hi,
I would like to understand something about Jetpack: who are the intended end-users? Whenever I heard presentations, I understood that jetpack targeted primarily web developers. If this is correct, you want to keep the programming style close to web-side JavaScript.
In particular, I believe that this means not reinventing inheritance.
Just my two cents,
David
--
You received this message because you are subscribed to the Google Groups "mozilla-labs-jetpack" group.
To view this discussion on the web visit https://groups.google.com/d/msg/mozilla-labs-jetpack/-/vQ0mplVeeVsJ.
see the doc and examples there :
http://livedocs.dojotoolkit.org/dojo/declare#inherited
also, Dojo automatically calls the super constructor. I'm not sure I
like this though.
Maybe it's not worth the added complexity of course, but when I had to
use Dojo, I found it was quite handy.
--
Julien
On 15 April 2012 06:18, Daniel <dani...@gmail.com> wrote:
> Here's an inheritance example from the Prime repo: https://github.com/mootools/prime/blob/master/test/prime/index.js
>
> --
> You received this message because you are subscribed to the Google Groups "mozilla-labs-jetpack" group.
> To view this discussion on the web visit https://groups.google.com/d/msg/mozilla-labs-jetpack/-/E52iQpa0PMIJ.
Here's an inheritance example from the Prime repo: https://github.com/mootools/prime/blob/master/test/prime/index.js
--You received this message because you are subscribed to the Google Groups "mozilla-labs-jetpack" group.
To view this discussion on the web visit https://groups.google.com/d/msg/mozilla-labs-jetpack/-/E52iQpa0PMIJ.
On Sunday, 2012-04-15 at 02:02 , Julien Wajsberg wrote:
I find that the way to call super methods is too verbose.Dojo contribute a method 'inherited' that permit to call the super method.see the doc and examples there :
I'd be more than happy to use a web standard, but unfortunately there is no such standard, JS is very flexible language and eachJS library / framework has it's own opinionated API for doing inheritance and that is different from project to project.
Main target audience for this API is people hacking on SDK itself.
(This is intentional to meet our security goals).
On Saturday, April 14, 2012 9:37:21 PM UTC+2, gozala wrote:I'd be more than happy to use a web standard, but unfortunately there is no such standard, JS is very flexible language and eachJS library / framework has it's own opinionated API for doing inheritance and that is different from project to project.
I tend to think that this is a good reason to not force web developers into one class-style inheritance mechanism and keep the prototype-based inheritance. On the other hand:Main target audience for this API is people hacking on SDK itself.
...means that you can indeed choose the paradigm you find most suited.
I do have a concern, though, that is not limited to the question of inheritance. While I follow the development of Jetpack only incidentally, what little recent code I have seen (typically, promise-related stuff) gives me the impression that there is a strong temptation to produce code that would fit nicely in the Haskell Platform or in OCaml Batteries Included. While I personally love FP, I fear that this would be counter-productive in the context, insofar as this could restrict the contributor base to people who can think in higher-order and functors.
Do you have any feedback on that style?
(This is intentional to meet our security goals).
That sounds interesting. Is there any document with the security goals and methods?
Thanks for the detailed reply.
Cheers,
David
--
You received this message because you are subscribed to the Google Groups "mozilla-labs-jetpack" group.
To view this discussion on the web visit https://groups.google.com/d/msg/mozilla-labs-jetpack/-/mk1qa3hasKEJ.