-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reintroduce +++ operator to mean concatenation with mutation #1111
Comments
It's just been renamed to |
ye, i figured only |
one more thing about it (generated from while (++a < list.length) {
if (b = querySelectorChild(list[a], '.section')) {
list = list.concat(querySelectorChildren(b, '.item'));
} the assignment is not needed, right, should be only |
No, that's what I was trying to say at the end of my comment: |
oh, my, i've missed the bug then.. any chance to resurrect |
+++ did exactly the same as ++ does |
maybe let's tweak it to |
Why? just use |
because with # ...
item = {} # all
list = [root] # all ordered
####
list ++= (querySelectorChildren box, '.item')
a = -1
while ++a < list.length
if b = querySelectorChild list[a], '.section'
list ++= (querySelectorChildren b, '.item')
# assign one more time :(
@item = item
@list = list
# ... see, i could assign it one-line at the top, have to add 2 more lines. # ...
@item = item = {} # all
@list = list = [root] # all ordered
####
list +++ (querySelectorChildren box, '.item')
a = -1
while ++a < list.length
if b = querySelectorChild list[a], '.section'
list +++ (querySelectorChildren b, '.item')
# ... makes sense? |
@determin1st Why can't you use # ...
@item = {} # all
@list = [root] # all ordered
####
@list ++= (querySelectorChildren box, '.item')
a = -1
while ++a < @list.length
if b = querySelectorChild @list[a], '.section'
@list ++= (querySelectorChildren b, '.item')
# ... What is wrong with above code? |
IMO, if you want to mutate an array by appending new elements, you should just call
|
@ceremcem well ye, i only wanted a bit of perfectionism, that can be done in multiple ways, but somehow @rhendric 9 characters plus engine implementation dependent, can't say how much arguments allowed to push(...b), i mean just a loop would be more solid and maybe faster |
Which implementations don't support |
i mean here, the "Merging two arrays" section: says:
i checked the limit was 65535 for the second array in Chromium. Sure, it's hard to reach but still.. |
|
i thought that i've made some tests: so, by the number of elements (in the second array): 20: loop is 18% faster .push is becoming faster starting from 60 elements in the second array so, for small arrays <60 elements and also for super huge arrays the loop is better i doubt that speed should be the driving factor of |
Can you tell why deprecate
+++
operator? It doesn't mess with++
right, must be the same precendence with++
, so could be "recovered" easily? Any story about it maybe :]my "projected" use-case:
The text was updated successfully, but these errors were encountered: