osdir.com
mailing list archive

Subject: [jira] Commented: (BOO-830) Substraction operator for arrays (+ bug on addition operator?) - msg#00066

List: lang.boo.devel

Date: Prev Next Index Thread: Prev Next Index

[
http://jira.codehaus.org/browse/BOO-830?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_96516
]

Arron Washington commented on BOO-830:
--------------------------------------

It violates the principle of least surprise, even though its technically
correct, I think is what Cedric is getting at, Rodrigo.

> Substraction operator for arrays (+ bug on addition operator?)
> --------------------------------------------------------------
>
> Key: BOO-830
> URL: http://jira.codehaus.org/browse/BOO-830
> Project: Boo
> Issue Type: New Feature
> Components: Compiler, Runtime (Boo.Lang)
> Reporter: Cedric Vivier
> Priority: Minor
> Fix For: 0.8
>
>
> Adding the substraction operator on boo arrays would be a nice handy feature :
> >>>cities = ['Tokyo', 'Barcelona', 'Moscow', 'Kuala Lumpur', 'Sidney']
> >>>visited = cities - ['Moscow', 'Sidney']
> Would give:
> ['Tokyo', 'Barcelona', 'Kuala Lumpur']
> Also there is surely a bug with array's '+ operator' :
> >>> cities = ['Tokyo', 'Barcelona', 'Moscow', 'Kuala Lumpur']
> >>>cities += 'London'
> Gives:
> ['Tokyo', 'Barcelona', 'Moscow', 'Kuala Lumpur', L, o, n, d, o, n]
> Hardly the expected and preferable behavior I think?

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira



---------------------------------------------------------------------
To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email




Was this page helpful?
Yes No
Thread at a glance:

Previous Message by Date: click to view message preview

[jira] Commented: (BOO-830) Substraction operator for arrays (+ bug on addition operator?)

[ http://jira.codehaus.org/browse/BOO-830?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_96514 ] Rodrigo B. de Oliveira commented on BOO-830: -------------------------------------------- Oddly enough that's the right behavior. You can Add anything IEnumerable to a List in which case all the elements are added. string enumerates over its characters. > Substraction operator for arrays (+ bug on addition operator?) > -------------------------------------------------------------- > > Key: BOO-830 > URL: http://jira.codehaus.org/browse/BOO-830 > Project: Boo > Issue Type: New Feature > Components: Compiler, Runtime (Boo.Lang) > Reporter: Cedric Vivier > Priority: Minor > Fix For: 0.8 > > > Adding the substraction operator on boo arrays would be a nice handy feature : > >>>cities = ['Tokyo', 'Barcelona', 'Moscow', 'Kuala Lumpur', 'Sidney'] > >>>visited = cities - ['Moscow', 'Sidney'] > Would give: > ['Tokyo', 'Barcelona', 'Kuala Lumpur'] > Also there is surely a bug with array's '+ operator' : > >>> cities = ['Tokyo', 'Barcelona', 'Moscow', 'Kuala Lumpur'] > >>>cities += 'London' > Gives: > ['Tokyo', 'Barcelona', 'Moscow', 'Kuala Lumpur', L, o, n, d, o, n] > Hardly the expected and preferable behavior I think? -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email

Next Message by Date: click to view message preview

[jira] Commented: (BOO-830) Substraction operator for arrays (+ bug on addition operator?)

[ http://jira.codehaus.org/browse/BOO-830?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_96520 ] Avishay Lavie commented on BOO-830: ----------------------------------- I agree - this behavior is highly unintuitive. Technically it's rather hard to circumvent (perhaps just hard-coding a special case for strings?) but that doesn't make it less of a (bad) surprise. A different option would be to separate the add-single-item and the concatenate-with-other-list behavior. Consider, for example, reserving "+" for "add this item" and "&" for "concatenate with items in this enumerable". {code} cities = ['Tokyo', 'Barcelona', 'Moscow', 'Kuala Lumpur', 'Sidney'] cities += 'London' >>> ['Tokyo', 'Barcelona', 'Moscow', 'Kuala Lumpur', 'Sidney', 'London'] cities &= 'London' >>> ['Tokyo', 'Barcelona', 'Moscow', 'Kuala Lumpur', 'Sidney', 'London', L, o, >>> n, d, o ,n] {code} > Substraction operator for arrays (+ bug on addition operator?) > -------------------------------------------------------------- > > Key: BOO-830 > URL: http://jira.codehaus.org/browse/BOO-830 > Project: Boo > Issue Type: New Feature > Components: Compiler, Runtime (Boo.Lang) > Reporter: Cedric Vivier > Priority: Minor > Fix For: 0.8 > > > Adding the substraction operator on boo arrays would be a nice handy feature : > >>>cities = ['Tokyo', 'Barcelona', 'Moscow', 'Kuala Lumpur', 'Sidney'] > >>>visited = cities - ['Moscow', 'Sidney'] > Would give: > ['Tokyo', 'Barcelona', 'Kuala Lumpur'] > Also there is surely a bug with array's '+ operator' : > >>> cities = ['Tokyo', 'Barcelona', 'Moscow', 'Kuala Lumpur'] > >>>cities += 'London' > Gives: > ['Tokyo', 'Barcelona', 'Moscow', 'Kuala Lumpur', L, o, n, d, o, n] > Hardly the expected and preferable behavior I think? -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email

Previous Message by Thread: click to view message preview

[jira] Commented: (BOO-830) Substraction operator for arrays (+ bug on addition operator?)

[ http://jira.codehaus.org/browse/BOO-830?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_96514 ] Rodrigo B. de Oliveira commented on BOO-830: -------------------------------------------- Oddly enough that's the right behavior. You can Add anything IEnumerable to a List in which case all the elements are added. string enumerates over its characters. > Substraction operator for arrays (+ bug on addition operator?) > -------------------------------------------------------------- > > Key: BOO-830 > URL: http://jira.codehaus.org/browse/BOO-830 > Project: Boo > Issue Type: New Feature > Components: Compiler, Runtime (Boo.Lang) > Reporter: Cedric Vivier > Priority: Minor > Fix For: 0.8 > > > Adding the substraction operator on boo arrays would be a nice handy feature : > >>>cities = ['Tokyo', 'Barcelona', 'Moscow', 'Kuala Lumpur', 'Sidney'] > >>>visited = cities - ['Moscow', 'Sidney'] > Would give: > ['Tokyo', 'Barcelona', 'Kuala Lumpur'] > Also there is surely a bug with array's '+ operator' : > >>> cities = ['Tokyo', 'Barcelona', 'Moscow', 'Kuala Lumpur'] > >>>cities += 'London' > Gives: > ['Tokyo', 'Barcelona', 'Moscow', 'Kuala Lumpur', L, o, n, d, o, n] > Hardly the expected and preferable behavior I think? -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email

Next Message by Thread: click to view message preview

[jira] Commented: (BOO-830) Substraction operator for arrays (+ bug on addition operator?)

[ http://jira.codehaus.org/browse/BOO-830?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_96520 ] Avishay Lavie commented on BOO-830: ----------------------------------- I agree - this behavior is highly unintuitive. Technically it's rather hard to circumvent (perhaps just hard-coding a special case for strings?) but that doesn't make it less of a (bad) surprise. A different option would be to separate the add-single-item and the concatenate-with-other-list behavior. Consider, for example, reserving "+" for "add this item" and "&" for "concatenate with items in this enumerable". {code} cities = ['Tokyo', 'Barcelona', 'Moscow', 'Kuala Lumpur', 'Sidney'] cities += 'London' >>> ['Tokyo', 'Barcelona', 'Moscow', 'Kuala Lumpur', 'Sidney', 'London'] cities &= 'London' >>> ['Tokyo', 'Barcelona', 'Moscow', 'Kuala Lumpur', 'Sidney', 'London', L, o, >>> n, d, o ,n] {code} > Substraction operator for arrays (+ bug on addition operator?) > -------------------------------------------------------------- > > Key: BOO-830 > URL: http://jira.codehaus.org/browse/BOO-830 > Project: Boo > Issue Type: New Feature > Components: Compiler, Runtime (Boo.Lang) > Reporter: Cedric Vivier > Priority: Minor > Fix For: 0.8 > > > Adding the substraction operator on boo arrays would be a nice handy feature : > >>>cities = ['Tokyo', 'Barcelona', 'Moscow', 'Kuala Lumpur', 'Sidney'] > >>>visited = cities - ['Moscow', 'Sidney'] > Would give: > ['Tokyo', 'Barcelona', 'Kuala Lumpur'] > Also there is surely a bug with array's '+ operator' : > >>> cities = ['Tokyo', 'Barcelona', 'Moscow', 'Kuala Lumpur'] > >>>cities += 'London' > Gives: > ['Tokyo', 'Barcelona', 'Moscow', 'Kuala Lumpur', L, o, n, d, o, n] > Hardly the expected and preferable behavior I think? -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email
Sign up for updates to this mailing list. email:
Loading Comments...
Home | News | Patents | Sitemap | FAQ | advertise

Advertising by