|
View:
New views
20 Messages
—
Rating Filter:
Alert me
|
|
|
Simpler syntax for appending to a listWhy can't we have a simpler syntax for appending to a List Instead of MyList.Add("node") , we could have MyList[] = "node" (PHP) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Boo Programming Language" group. To post to this group, send email to boolang@... To unsubscribe from this group, send email to boolang+unsubscribe@... For more options, visit this group at http://groups.google.com/group/boolang?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Simpler syntax for appending to a listwell, MyList[] = "node" looks more like you just created a list of "n","o","d","e"... .NET has more understandable syntax in this case :)
2009/9/1 Sandeep <sandeep.aspx@...>
--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Boo Programming Language" group. To post to this group, send email to boolang@... To unsubscribe from this group, send email to boolang+unsubscribe@... For more options, visit this group at http://groups.google.com/group/boolang?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Simpler syntax for appending to a listOn Tue, Sep 1, 2009 at 11:33 PM, Sandeep <sandeep.aspx@...> wrote: Why can't we have a simpler syntax for appending to a List I don't think we want this syntax which exist only in PHP (afaik) and is not a shiny example of readability. However we might want to overload the "+=" operator on Boo generic lists (Boo.Lang.List[of T]) to support by default : myList += "node" If not, nonetheless I guess we should support operator-overloading extension methods in Boo (extensions named op_*), as it seems it is not supported/handled right now. Opinions? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Boo Programming Language" group. To post to this group, send email to boolang@... To unsubscribe from this group, send email to boolang+unsubscribe@... For more options, visit this group at http://groups.google.com/group/boolang?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Simpler syntax for appending to a listi think both ideas are good (+= for appending for generic lists) and operator overloading in extension method sound wild.. although it'd put boo in front of c#, which is a good or bad thing, depending on your opinion On Tue, Sep 1, 2009 at 9:11 AM, Cedric Vivier<cedricv@...> wrote: > On Tue, Sep 1, 2009 at 11:33 PM, Sandeep <sandeep.aspx@...> wrote: >> >> Why can't we have a simpler syntax for appending to a List >> Instead of MyList.Add("node") , we could have >> MyList[] = "node" (PHP) >> > > I don't think we want this syntax which exist only in PHP (afaik) and is not > a shiny example of readability. > > However we might want to overload the "+=" operator on Boo generic lists > (Boo.Lang.List[of T]) to support by default : > myList += "node" > > If not, nonetheless I guess we should support operator-overloading extension > methods in Boo (extensions named op_*), as it seems it is not > supported/handled right now. > > Opinions? > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Boo Programming Language" group. To post to this group, send email to boolang@... To unsubscribe from this group, send email to boolang+unsubscribe@... For more options, visit this group at http://groups.google.com/group/boolang?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Simpler syntax for appending to a list+1 for the += operator overload
Rafael "Monoman" Teixeira --------------------------------------- "To be creative means to be in love with life. You can be creative only if you love life enough that you want to enhance its beauty, you want to bring a little more music to it, a little more poetry to it, a little more dance to it." Osho On Tue, Sep 1, 2009 at 1:11 PM, Cedric Vivier <cedricv@...> wrote:
--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Boo Programming Language" group. To post to this group, send email to boolang@... To unsubscribe from this group, send email to boolang+unsubscribe@... For more options, visit this group at http://groups.google.com/group/boolang?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Simpler syntax for appending to a listYeah, += sounds good :)
2009/9/1 Rafael Teixeira <monoman@...> +1 for the += operator overload --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Boo Programming Language" group. To post to this group, send email to boolang@... To unsubscribe from this group, send email to boolang+unsubscribe@... For more options, visit this group at http://groups.google.com/group/boolang?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Simpler syntax for appending to a list-1, operator overloading is oft abused and here does it really gain readability by being += instead of .Add?
I know in C++, I found people using += to add to collections to be annoying. I think the word is much more readable. Keep the operators for math operations and string concat imo. On Tue, Sep 1, 2009 at 3:08 PM, Processor Devil <processor.dev1l@...> wrote: Yeah, += sounds good :) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Boo Programming Language" group. To post to this group, send email to boolang@... To unsubscribe from this group, send email to boolang+unsubscribe@... For more options, visit this group at http://groups.google.com/group/boolang?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Simpler syntax for appending to a listNathan Stott wrote: > -1, operator overloading is oft abused and here does it really gain > readability by being += instead of .Add? > > I know in C++, I found people using += to add to collections to be > annoying. I think the word is much more readable. Keep the operators > for math operations and string concat imo. -1 from me, too. If you really want that operator, then you can still add it yourself using an extension method: [Extension] def op_Addition(l as List of string, item as string): l.Add(item) return l x = List of string() x = x + "test" Unfortunately this doesn't seem to work if you make the extension method generic. Compiler bug? Daniel --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Boo Programming Language" group. To post to this group, send email to boolang@... To unsubscribe from this group, send email to boolang+unsubscribe@... For more options, visit this group at http://groups.google.com/group/boolang?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Simpler syntax for appending to a listI think it has to be declared on the type? That would be a pretty fun trick though.
On Tue, Sep 1, 2009 at 5:09 PM, Daniel Grunwald <daniel@...> wrote:
-- Justin Chase http://www.justnbusiness.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Boo Programming Language" group. To post to this group, send email to boolang@... To unsubscribe from this group, send email to boolang+unsubscribe@... For more options, visit this group at http://groups.google.com/group/boolang?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Simpler syntax for appending to a listJustin Chase wrote: > I think it has to be declared on the type? That would be a pretty fun > trick though. > Marking the operator as [Extension] does the job of "declaring it on the type". You can already add operators to non-generic classes this way (or to instantiations of generic classes); the only thing not possible in current Boo is to add a generic operator to a generic class. Daniel --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Boo Programming Language" group. To post to this group, send email to boolang@... To unsubscribe from this group, send email to boolang+unsubscribe@... For more options, visit this group at http://groups.google.com/group/boolang?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Simpler syntax for appending to a listThis appears to not work at all for me:
import System yields the error: Operator '+' cannot be used with a left hand side of type 'BooPlayground.Foo' and a right hand side of type 'BooPlayground.Foo'. (BCE0051) - C:\Users\jchase\Documents\SharpDevelop Projects\BooPlayground\Program.boo:17,9
What am I doing wrong? On Wed, Sep 2, 2009 at 8:53 AM, Daniel Grunwald <daniel@...> wrote:
-- Justin Chase http://www.justnbusiness.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Boo Programming Language" group. To post to this group, send email to boolang@... To unsubscribe from this group, send email to boolang+unsubscribe@... For more options, visit this group at http://groups.google.com/group/boolang?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Simpler syntax for appending to a listOn Wed, Sep 2, 2009 at 11:51 PM, Justin Chase <justin.m.chase@...> wrote:
This was the second part of the suggestion. Boo does not currently support extension methods for operator overloads, thus you need to declare the method in Foo directly. Cheers, --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Boo Programming Language" group. To post to this group, send email to boolang@... To unsubscribe from this group, send email to boolang+unsubscribe@... For more options, visit this group at http://groups.google.com/group/boolang?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Simpler syntax for appending to a listOn Wed, Sep 2, 2009 at 12:51 PM, Justin Chase<justin.m.chase@...> wrote: > ... > What am I doing wrong? The operator is not visible at that point. Either declare it at the module level or import Extensions. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Boo Programming Language" group. To post to this group, send email to boolang@... To unsubscribe from this group, send email to boolang+unsubscribe@... For more options, visit this group at http://groups.google.com/group/boolang?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Simpler syntax for appending to a listI see, it sounded like he was saying it already worked. That might be a pretty cool feature though.
On Wed, Sep 2, 2009 at 11:37 AM, Cedric Vivier <cedricv@...> wrote:
-- Justin Chase http://www.justnbusiness.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Boo Programming Language" group. To post to this group, send email to boolang@... To unsubscribe from this group, send email to boolang+unsubscribe@... For more options, visit this group at http://groups.google.com/group/boolang?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Simpler syntax for appending to a listJustin Chase wrote: > This appears to not work at all for me: > ... > > yields the error: > Operator '+' cannot be used with a left hand side of type > 'BooPlayground.Foo' and a right hand side of type 'BooPlayground.Foo'. > (BCE0051) - C:\Users\jchase\Documents\SharpDevelop > Projects\BooPlayground\Program.boo:17,9 Strange. If you remove the "static class Extensions" and let the operator be a global method (part of the implicitly defined module); your example will work fine. Daniel --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Boo Programming Language" group. To post to this group, send email to boolang@... To unsubscribe from this group, send email to boolang+unsubscribe@... For more options, visit this group at http://groups.google.com/group/boolang?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Simpler syntax for appending to a listOn Wed, Sep 2, 2009 at 1:37 PM, Cedric Vivier<cedricv@...> wrote: > ... > Boo does not currently support extension methods for operator overloads... It has partial support for it. Generic operators are still not supported. The following works: import System class Foo: [property(Value)] value as int [Extension] def op_Addition(f1 as Foo, f2 as Foo): return Foo(Value: f1.Value + f2.Value) f1 = Foo( Value: 10 ) f2 = Foo( Value: 20 ) f3 = f1 + f2 print "Value: ${f3.Value}" --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Boo Programming Language" group. To post to this group, send email to boolang@... To unsubscribe from this group, send email to boolang+unsubscribe@... For more options, visit this group at http://groups.google.com/group/boolang?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Simpler syntax for appending to a listyou need to import the class itself, not just the namespace
On Wed, Sep 2, 2009 at 8:09 PM, Daniel Grunwald <daniel@...> wrote:
--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Boo Programming Language" group. To post to this group, send email to boolang@... To unsubscribe from this group, send email to boolang+unsubscribe@... For more options, visit this group at http://groups.google.com/group/boolang?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Simpler syntax for appending to a listI'm sorry I don't understand what you mean, can you give a code snippet?
On Wed, Sep 2, 2009 at 12:47 PM, Ayende Rahien <ayende@...> wrote:
-- Justin Chase http://www.justnbusiness.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Boo Programming Language" group. To post to this group, send email to boolang@... To unsubscribe from this group, send email to boolang+unsubscribe@... For more options, visit this group at http://groups.google.com/group/boolang?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Simpler syntax for appending to a listI see, so putting the extension in a static class was screwing it up?
On Wed, Sep 2, 2009 at 12:29 PM, Rodrigo B. de Oliveira <rodrigobamboo@...> wrote:
-- Justin Chase http://www.justnbusiness.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Boo Programming Language" group. To post to this group, send email to boolang@... To unsubscribe from this group, send email to boolang+unsubscribe@... For more options, visit this group at http://groups.google.com/group/boolang?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Simpler syntax for appending to a listOn Wed, Sep 2, 2009 at 7:51 PM, Justin Chase<justin.m.chase@...> wrote: > I see, so putting the extension in a static class was screwing it up? > In a way, in a way... --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Boo Programming Language" group. To post to this group, send email to boolang@... To unsubscribe from this group, send email to boolang+unsubscribe@... For more options, visit this group at http://groups.google.com/group/boolang?hl=en -~----------~----~----~----~------~----~------~--~--- |
| Free embeddable forum powered by Nabble | Forum Help |