On 12/4/06, Thomas Fuchs <[EMAIL PROTECTED]> wrote:
> What are you talking about? We're not writing Prototype for some version
> of JavaScript that might or might not arrive years from now.

Given that:

1. The language can change. I think 'years from now' is unlikely but
that's not important to the argument.
2. Prototype hacking is not namespaced.

I'm arguing that a future language change could conflict with an
enhancement in Prototype.

For example, let's say that the standards group desides Array.each
will take an array of arrays and appends the lhs array onto the end of
all the arrays passed as arguments (this is a pretty dumb idea, but
it's just an example).

The prototype maintainers either have to break compatibility with all
the prototype code out there or have to break Array.each for everybody
else. I don't like the idea of my code breaking in the future (I make
pages that wind up in public sector use, so an app running 6-7 years
is not farfetched) nor do I like the idea of my choices causing
someone else's code to break. It's the same scenario as javascript
libraries clobbering each others' prototype extensions but with the
language itself instead of a library.

I don't think this scenario is very likely, but it does illustrate why
I oppose prototype hacking on shared objects (Object, Date, Array,
String, RegEx, etc). This is a response to the original assertion:

> People are actually afraid only of Array.prototype augmentation,
> because they have been using them as associative arrays all this time.

I have never used arrays as associative arrays and I have a technical
reason for rejecting prototype hacking. People are free to decide that
scenarios like this are too remote to be worth considering for their
projects, and I expect most prototype developers will, but that
doesn't mean my position is invalid.

> I'd trade in having.to.write.long.lines() for concise code every day.

I hate writing namespaced code and only do it when my code is likely
to wind up in a mixed environment. I appreciate being able to make the
decision.

--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to