D
Dmitry A. Soshnikov
[snip already discussed not once things]
I meant when you can you system with all its features without limiting
yourself with some invariant inflexible patterns which force you to
write in a way of some other languages
Yeah, I've heard your argument that authors of some languages such as
ECMAScript, Ruby, etc. make this ability to write useful elegant code
augmenting built-ins with new functionality just as a big and
understandable mistake. Right?
But I tell you – no, it's not. It's special useful ability to do soif
you're free from well-known issues related to it.
And you – just haven't even rights to tell in tone in your documentas
"Don't touch!" Who are you to talk in this tone?
[snip]
I've already explained. Again – that mean when you completely know the
system (the language) and able to use all its features specially
designed for that.
Sure, but you don't see that specially designed feature with
augmenting objects (any object and especially built-ins) - is also
pros.
Your argument "you just like it, it's not logical argument" which
you're continue to use seems really don't understand that that "like"
– is the feature which was specially designed. To use this feature or
not – that's only your decision which maybe based on a habit from
languages such as C++ or Java.
Though, e.g. in Python it's impossible to augment built-ins, but still
possible to dynamically augment any other user-defined objects (but
you against any augmentation of any objects that you don't own, so
that's also is not your case).
That's other thing and pattern of programming and is not related to
dynamic properties definition.
Yep, I also use term "mixin".
Because of "A.prototype = new B;"?
If you use Math.abs(...) – no everything depends on Math? Right. But
maybe do not program at all in this case?
No, that's OK, until you start think that you think out something the
one and only which is thought inflexible and start to describe it in
tone like "Don't touch".
I repeat, in system which I know and completely control (I don't
augment Object.prototype, I don't use 3rd-party libs), it's very
useful ability designed by the author of the language – to use new
functionality directly on object – that's elegant and useful. And yeah
– sure it's the main argument of such feature, and exactly with that
argument it was designed, so please don't use that argument ("you just
like it") against me, k? You can continue to write in a way of
Pascal or C++ or Java or whatever. Yeah, programming on Ruby is also
is counter-indicative to you – there also augmentation of built-ins
(as additional modules) is often used.
[snip useless parts of talk]
I don't mind with Crockford's buggy `String.prototype.trim`.
Please answer, which problems will I have if I:
(a) had own implementation of ‘.trim' and used it as ‘ string '.trim()
(b) then switch to built-in implementation and use it in the same way
Why do you still continue spread some strange case when some
(ostensibly) want to overwrite built-in implementation with own?
That's again demagogy (yes, again).
[snip the same; discussed not once alreay]
Sure, and which consequences will I have in system I fully know and
control (for you that means: I don't augment Object.prototype and
don't use 3rd-party libs)? For what reason I should limit myself and
do not use useful and elegant feature provided by the author of the
language as a part of its ideology?
Who is here ignoring the known consequences? Should I repeat again
that I know and understand all that consequences? But in system I
fully know (and don't afraid of it) and control (you should read this
as: I don't augment Object.prototype and don't use 3rd-party libs) –
for what reason I should limit myself and do not use useful and
elegant feature provided by the author of the language as a part of
its ideology (yeah, I copy-pasted it from previous sentence).
What do you mean "difficult"? How do you think for what authors of
languages such as ECMAScript or Ruby or any else provided such
feature? Sure this elegant and useful (and logical – method/properties
of strings I can but into the String.prototype – the place specially
marked for it) syntactic sugar which is *specially* provided by the
authors. And again repeat – from the functionality viewpoint there's
no difference – that's your choice to write in procedural style, but
the authors decided to make such useful sugar which is really elegant
and which is really pros from this viewpoint. For what reason I
should limit myself and do not use useful and elegant feature provided
by the author of the language as a part of its ideology (yeah, I copy-
pasted it from previous sentence).
I don't understand why should we talk in manner – "is it difficult to
you do not use it and do it in a way I think out and think that this
is the one and only way. Yeah, I understand that it doesn't use
special feature of dynamic augmentation of built-ins and moreover I
believe it as a language and design mistake, but help me to fill
myself protected and leave my fear. So, please, don't do it... No, not
like this... Like this: Don't do it! Don't touch! It's difficult,
right? Don't do it."
The "problem"? Why do you call it so? It's called useful and specially
designed feature of some well-known dynamic based language with
possibility mix in new functionality (in Ruby by the way, this term
"mixin" – is official).
But who ever said this? I let myself to copy-paste again from previous
sentence:
(a) had own implementation of ‘.trim' and used it as ‘ string '.trim()
(b) then switch to built-in implementation and use it in the same way
Why do you still continue spread some strange case when some
(ostensibly) want to overwrite built-in implementation with own?
That's again demagogy (yes, again).
Actually I don't see any reason to do so, even without any
justification. But with that I didn't say a word about such case.
Be sure.
The situation when some overwrite built-ins existing functionality
with own one? I didn't mean this – see again example with ‘trim' (what
exactly did I mean). If you want to exactly *fix* some bug – this is
completely on your conscience when and how will you make (if ever) it.
If the system is uncontrollable, how can you program it? When
functionality of Format in your example will change, you can change it
in the same way (or remove if not needed) in your widget. But I meant
not that.
That's I've told – you see and analyze some tops, but should see
deeply. This syntax errors are completely not about the topic and you
use it (and mention) specially to show what the nonsense I write,
which means – maybe I even don't know the language on the level of
syntax errors, right? Do you like it or not, but it's called direct
"demagogy" (and yes – again)
About the "If" – I used Microsoft Word when was answering that time,
so it maybe it was converted automatically, don't know. But even that
doesn't justify your demagogy, sorry.
Yeah, get the 10 points for mentioning invalid syntax
What kind of solution are you talking about? Take the use-case (I let
myself to copy-paste again taking into account that you like to carp
to things which are not related to the topic – which is – maybe it's
hard to you to see main goal of the talk – that's why you should waste
your (and which is even worse - mine) time on talking about absolutely
non-related things spreading demagogy about syntax errors just like I
don't language on that newbie level, right? Right. Take the 10
points ):
I don't augment Object.prototype and don't use 3rd-party libs? For
what reason I should limit myself and do not use useful and elegant
feature provided by the author of the language as a part of its
ideology?
[snip the same]
What do you mean? I always knew all the issues. Now you're talking
just like you explain me something and I agree. It is pleasant to you
whether or not, but it demagogy (yeah, sorry, again).
Which problems? Again (I won't get tired to repeat, though, it's easy
to copy-paste myself):
I don't augment Object.prototype and don't use 3rd-party libs? For
what reason I should limit myself and do not use useful and elegant
feature provided by the author of the language as a part of its
ideology?
And yes, from the ideological viewpoint – it's very useful syntactic
sugar pros.
If I don't have that problems (which I also know) – (get ready – copy-
paste comes ) - for what reason I should limit myself and do not use
useful and elegant feature provided by the author of the language as a
part of its ideology?
OK, I'm glad that you understand that.
Yeah, but vice versa - "foo".capitalize is better and useful
alternative for the style of other languages which have no such
ability and forced to write in procedural way (regarding to the case).
OK, I'm glad to that you understand (have understood) that.
I've explained what I meant (not this). How to see that – that your
choice.
It's fair and related to the ECMAScript and well-known features.
Well, you can choose this formulation also, it's more fairly than your
previous with "Don't touch". Although, you can add "...there are known
problems with that if (and shortly describe the issues – that user can
decide and choose – will he use it on not)"
/ds
Full power?
I meant when you can you system with all its features without limiting
yourself with some invariant inflexible patterns which force you to
write in a way of some other languages
Yeah, I've heard your argument that authors of some languages such as
ECMAScript, Ruby, etc. make this ability to write useful elegant code
augmenting built-ins with new functionality just as a big and
understandable mistake. Right?
But I tell you – no, it's not. It's special useful ability to do soif
you're free from well-known issues related to it.
And you – just haven't even rights to tell in tone in your documentas
"Don't touch!" Who are you to talk in this tone?
[snip]
Again with the full power.
I've already explained. Again – that mean when you completely know the
system (the language) and able to use all its features specially
designed for that.
Design decisions should be based on pros and cons; not some absolute
ideal of how the author would have redesigned some other piece of code.
Sure, but you don't see that specially designed feature with
augmenting objects (any object and especially built-ins) - is also
pros.
Your argument "you just like it, it's not logical argument" which
you're continue to use seems really don't understand that that "like"
– is the feature which was specially designed. To use this feature or
not – that's only your decision which maybe based on a habit from
languages such as C++ or Java.
Though, e.g. in Python it's impossible to augment built-ins, but still
possible to dynamically augment any other user-defined objects (but
you against any augmentation of any objects that you don't own, so
that's also is not your case).
Objects can talk to each other but should not be modifying each other.
That's other thing and pattern of programming and is not related to
dynamic properties definition.
YUI calls it "augmentObject", I call
it "mixin". Either name is fine by me, really it is obvious enough.
var AB = APE.mixin(A, B);
Yep, I also use term "mixin".
That way I've created an object dynamically, not statically. But notice
that I am not saying something like:
A.js:
function A(){
}
B.prototype.ddd = function(){
//lets fix this buggy method.
this.ddd = Math.abs(this.d);
};
A.prototype = new B;
Oh, now the same problem as with TableRenderer, I've just created a
dependency cycle. NOw B depends on A. F.
Because of "A.prototype = new B;"?
If you use Math.abs(...) – no everything depends on Math? Right. But
maybe do not program at all in this case?
Why not?
No, that's OK, until you start think that you think out something the
one and only which is thought inflexible and start to describe it in
tone like "Don't touch".
I repeat, in system which I know and completely control (I don't
augment Object.prototype, I don't use 3rd-party libs), it's very
useful ability designed by the author of the language – to use new
functionality directly on object – that's elegant and useful. And yeah
– sure it's the main argument of such feature, and exactly with that
argument it was designed, so please don't use that argument ("you just
like it") against me, k? You can continue to write in a way of
Pascal or C++ or Java or whatever. Yeah, programming on Ruby is also
is counter-indicative to you – there also augmentation of built-ins
(as additional modules) is often used.
[snip useless parts of talk]
If you want to make a real argument, going from abstraction to
concretion, we can see an example. We have already seen the example with
Crockford's buggy `String.prototype.trim`.
I don't mind with Crockford's buggy `String.prototype.trim`.
Please answer, which problems will I have if I:
(a) had own implementation of ‘.trim' and used it as ‘ string '.trim()
(b) then switch to built-in implementation and use it in the same way
Why do you still continue spread some strange case when some
(ostensibly) want to overwrite built-in implementation with own?
That's again demagogy (yes, again).
[snip the same; discussed not once alreay]
Wrong design? No, not right or wrong. I tend to more think in terms of
actions and consequences.
Sure, and which consequences will I have in system I fully know and
control (for you that means: I don't augment Object.prototype and
don't use 3rd-party libs)? For what reason I should limit myself and
do not use useful and elegant feature provided by the author of the
language as a part of its ideology?
Saying "I know what I'm doing" while ignoring the known consequences
Who is here ignoring the known consequences? Should I repeat again
that I know and understand all that consequences? But in system I
fully know (and don't afraid of it) and control (you should read this
as: I don't augment Object.prototype and don't use 3rd-party libs) –
for what reason I should limit myself and do not use useful and
elegant feature provided by the author of the language as a part of
its ideology (yeah, I copy-pasted it from previous sentence).
Is it difficult to use your own objects and not modify the built-ins?
What do you mean "difficult"? How do you think for what authors of
languages such as ECMAScript or Ruby or any else provided such
feature? Sure this elegant and useful (and logical – method/properties
of strings I can but into the String.prototype – the place specially
marked for it) syntactic sugar which is *specially* provided by the
authors. And again repeat – from the functionality viewpoint there's
no difference – that's your choice to write in procedural style, but
the authors decided to make such useful sugar which is really elegant
and which is really pros from this viewpoint. For what reason I
should limit myself and do not use useful and elegant feature provided
by the author of the language as a part of its ideology (yeah, I copy-
pasted it from previous sentence).
No, we've established that it is not difficult.
I don't understand why should we talk in manner – "is it difficult to
you do not use it and do it in a way I think out and think that this
is the one and only way. Yeah, I understand that it doesn't use
special feature of dynamic augmentation of built-ins and moreover I
believe it as a language and design mistake, but help me to fill
myself protected and leave my fear. So, please, don't do it... No, not
like this... Like this: Don't do it! Don't touch! It's difficult,
right? Don't do it."
The only remaining
problem is that you like seeing "foo".capitalize.
The "problem"? Why do you call it so? It's called useful and specially
designed feature of some well-known dynamic based language with
possibility mix in new functionality (in Ruby by the way, this term
"mixin" – is official).
What is the good reason for
redefining the language to your deviations?
But who ever said this? I let myself to copy-paste again from previous
sentence:
(a) had own implementation of ‘.trim' and used it as ‘ string '.trim()
(b) then switch to built-in implementation and use it in the same way
Why do you still continue spread some strange case when some
(ostensibly) want to overwrite built-in implementation with own?
That's again demagogy (yes, again).
Any justificaiton for doing
that would
Actually I don't see any reason to do so, even without any
justification. But with that I didn't say a word about such case.
What is equal? Do you know what a dependency cycle is?
Be sure.
I explained a
situation
The situation when some overwrite built-ins existing functionality
with own one? I didn't mean this – see again example with ‘trim' (what
exactly did I mean). If you want to exactly *fix* some bug – this is
completely on your conscience when and how will you make (if ever) it.
If the system is uncontrollable, how can you program it? When
functionality of Format in your example will change, you can change it
in the same way (or remove if not needed) in your widget. But I meant
not that.
A bunch of nonsense there.
Specially.
That is not what I argued. It is thoughtless, invalid code, written in
what would appear to be global context, and will result in SyntaxError
because of calling undefined identifier `If`, and having a misplaced
`else` block.
That's I've told – you see and analyze some tops, but should see
deeply. This syntax errors are completely not about the topic and you
use it (and mention) specially to show what the nonsense I write,
which means – maybe I even don't know the language on the level of
syntax errors, right? Do you like it or not, but it's called direct
"demagogy" (and yes – again)
About the "If" – I used Microsoft Word when was answering that time,
so it maybe it was converted automatically, don't know. But even that
doesn't justify your demagogy, sorry.
I didn't see you're solution. (the code you repeated 10x or so, with
invalid syntax is irrelevant).
Yeah, get the 10 points for mentioning invalid syntax
What kind of solution are you talking about? Take the use-case (I let
myself to copy-paste again taking into account that you like to carp
to things which are not related to the topic – which is – maybe it's
hard to you to see main goal of the talk – that's why you should waste
your (and which is even worse - mine) time on talking about absolutely
non-related things spreading demagogy about syntax errors just like I
don't language on that newbie level, right? Right. Take the 10
points ):
I don't augment Object.prototype and don't use 3rd-party libs? For
what reason I should limit myself and do not use useful and elegant
feature provided by the author of the language as a part of its
ideology?
[snip the same]
You seemed to agree earlier that there are problems with such design
approach.
What do you mean? I always knew all the issues. Now you're talking
just like you explain me something and I agree. It is pleasant to you
whether or not, but it demagogy (yeah, sorry, again).
Does perceived benefit of using "".capitalize (you like it) outweigh
those problems?
Which problems? Again (I won't get tired to repeat, though, it's easy
to copy-paste myself):
I don't augment Object.prototype and don't use 3rd-party libs? For
what reason I should limit myself and do not use useful and elegant
feature provided by the author of the language as a part of its
ideology?
And yes, from the ideological viewpoint – it's very useful syntactic
sugar pros.
Increased likelihood of onflicts with code added by another contributor,
a third party library, a future ECMAScript specification/proposal.
Not as clear as to who owns that functionality or where the
functionality is defined ("where is this method coming from?").
If I don't have that problems (which I also know) – (get ready – copy-
paste comes ) - for what reason I should limit myself and do not use
useful and elegant feature provided by the author of the language as a
part of its ideology?
I believe that you like the effect of modifying String.prototype, seeing
"foo".capitalize
OK, I'm glad that you understand that.
and that you don't find an alternative that is as
attractive.
Yeah, but vice versa - "foo".capitalize is better and useful
alternative for the style of other languages which have no such
ability and forced to write in procedural way (regarding to the case).
You seem to see the problems associated with modifying String.prototype.
Probably because it is not causing problems for you directly.
OK, I'm glad to that you understand (have understood) that.
Then you
questioned my ability to think abstractly.
I've explained what I meant (not this). How to see that – that your
choice.
"Be careful" is not really going to be defining something that could be
flagged in code. It is too vague.
It's fair and related to the ECMAScript and well-known features.
You can say "be careful, the code modifies somebody else's object and
there are known problems with that." That is part of code review
guidelines.
Well, you can choose this formulation also, it's more fairly than your
previous with "Don't touch". Although, you can add "...there are known
problems with that if (and shortly describe the issues – that user can
decide and choose – will he use it on not)"
/ds