kanaida Active Member Licensed User Longtime User Oct 4, 2012 #1 I know this is probably a tall order, but i feel it would make things so much less verbose. If you've ever used LINQ, the syntax is something like this Code: Copy Dim Stuff() as SomeObjectType = from x in SomeList Where x.contains("123") order by x.SomeProperty Basically like in-line sql queries. To do the equivalent right now it would take a few loops, if statements, etc... and it's not as nice and clear as the example above. Now I know that java itself doesn't natively support this, but we are *converting* to java aren't we? so at least some basic functions could be implemented in the syntax like the where and sort clauses, giving us a list or array in return. Perhaps: Code: Copy Dim Stuff() as MyClass Stuff = SomeNewBaFunction(YourOriginalListOfStuff() as object, WhereClause as string) Dim Stuff2() as MyClass Stuff = SomeNewBaFunction2(YourOriginalListOfStuff() as object, WhereClause as string,OrderBy as string) Might work I'm just paying attention to the things I seem to be coding repeatedly to do pretty much anything. The other thing we can perhaps do is related to strings to write less code is allow in-line values where b4A takes care of all the &'s and "" around text when used like this: Dim Value1 as string = "SomeValue" Dim Value2 as string = "SomeOtherValue" Dim FinalString = "The first <%= Value1 %> does not equal: <%= Value2 %>" Click to expand...
I know this is probably a tall order, but i feel it would make things so much less verbose. If you've ever used LINQ, the syntax is something like this Code: Copy Dim Stuff() as SomeObjectType = from x in SomeList Where x.contains("123") order by x.SomeProperty Basically like in-line sql queries. To do the equivalent right now it would take a few loops, if statements, etc... and it's not as nice and clear as the example above. Now I know that java itself doesn't natively support this, but we are *converting* to java aren't we? so at least some basic functions could be implemented in the syntax like the where and sort clauses, giving us a list or array in return. Perhaps: Code: Copy Dim Stuff() as MyClass Stuff = SomeNewBaFunction(YourOriginalListOfStuff() as object, WhereClause as string) Dim Stuff2() as MyClass Stuff = SomeNewBaFunction2(YourOriginalListOfStuff() as object, WhereClause as string,OrderBy as string) Might work I'm just paying attention to the things I seem to be coding repeatedly to do pretty much anything. The other thing we can perhaps do is related to strings to write less code is allow in-line values where b4A takes care of all the &'s and "" around text when used like this: Dim Value1 as string = "SomeValue" Dim Value2 as string = "SomeOtherValue" Dim FinalString = "The first <%= Value1 %> does not equal: <%= Value2 %>" Click to expand...
M mjcoon Well-Known Member Licensed User Oct 4, 2012 #2 kanaida said: ..., but we are *converting* to java aren't we? Click to expand... Maybe in Basic4Android, but this forum is Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Basic4ppc Wishlist Click to expand... Mike.
kanaida said: ..., but we are *converting* to java aren't we? Click to expand... Maybe in Basic4Android, but this forum is Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Basic4ppc Wishlist Click to expand... Mike.
kanaida Active Member Licensed User Longtime User Oct 4, 2012 #3 Good call Can anyone please move this thread to the B4A wishlist? thanks
C COBRASoft Active Member Licensed User Longtime User Oct 6, 2012 #5 Linq is a nice thing to have, Lambda expressions even nicer since they form the base for Linq. I can imagine that implementing Lambda expressions (and Linq) would require a LOT of work from Erel and it's probably not worth the effort for the coming year(s). Lambda expressions are translated into functional code, so you can make your own functions for searching through a list, sorting a list, ... like you already suggested. In my grid module you can find some of these functions for lists made by me (where, sort, ...). They're not Lambda or Linq, but help you a lot further to accomplish difficult or repetitive tasks already.
Linq is a nice thing to have, Lambda expressions even nicer since they form the base for Linq. I can imagine that implementing Lambda expressions (and Linq) would require a LOT of work from Erel and it's probably not worth the effort for the coming year(s). Lambda expressions are translated into functional code, so you can make your own functions for searching through a list, sorting a list, ... like you already suggested. In my grid module you can find some of these functions for lists made by me (where, sort, ...). They're not Lambda or Linq, but help you a lot further to accomplish difficult or repetitive tasks already.
W wl Well-Known Member Licensed User Longtime User May 29, 2013 #6 Bumping this thread as it might be nice of including something like this in B4A 2.8