tag:blogger.com,1999:blog-1532151022505671498.post3006694943768269123..comments2024-03-12T15:33:25.350+01:00Comments on Delphi sorcery: Lambdas and expression trees in DelphiStefan Glienkehttp://www.blogger.com/profile/05509404049325709406noreply@blogger.comBlogger8125tag:blogger.com,1999:blog-1532151022505671498.post-76081263623973909882011-08-26T09:06:20.621+02:002011-08-26T09:06:20.621+02:00That is true. And actually I don't like that g...That is true. And actually I don't like that global variable thing anyway. I will see if I can solve this in some simple way because this whole thing is more of a proof of concept anyway.Stefan Glienkehttps://www.blogger.com/profile/09320735081289619570noreply@blogger.comtag:blogger.com,1999:blog-1532151022505671498.post-55220161295477148972011-08-26T00:46:38.231+02:002011-08-26T00:46:38.231+02:00I was looking at this a little bit more. Looks to...I was looking at this a little bit more. Looks to me like this wouldn't be thread-safe, with the expression stack being a global variable...Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1532151022505671498.post-54329988480425294572011-07-29T13:43:37.595+02:002011-07-29T13:43:37.595+02:00Same here, I linked to your original post.Same here, I linked to your original post.Stefan Glienkehttps://www.blogger.com/profile/09320735081289619570noreply@blogger.comtag:blogger.com,1999:blog-1532151022505671498.post-6196040189210189612011-07-29T13:38:56.174+02:002011-07-29T13:38:56.174+02:00Similar stuff :)
http://www.delphi-forum.de/viewto...Similar stuff :)<br />http://www.delphi-forum.de/viewtopic.php?t=103194Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1532151022505671498.post-5640452306287326332011-06-21T20:45:56.774+02:002011-06-21T20:45:56.774+02:00Nice, so basically what I was planning to do with ...Nice, so basically what I was planning to do with those expressions. No wonder lambda expressions were basically one of the things they implemented to make LinQ work.<br /><br />I wonder if it is possible to create some IDE plugin that fakes code completion for custom variant types because Delphi does not have that type safety on dynamic (i.e custom variant types) types.Stefan Glienkehttps://www.blogger.com/profile/09320735081289619570noreply@blogger.comtag:blogger.com,1999:blog-1532151022505671498.post-5042594606184098132011-06-21T17:19:00.650+02:002011-06-21T17:19:00.650+02:00Kind of a long story. Short version: I've bee...Kind of a long story. Short version: I've been working on converting the storage for my game engine from flat files to a Firebird embedded database. This lets me load stuff into memory a lot faster, because I can use lazy loading instead of reading in the entire file all at once.<br /><br />The downside is, I don't have everything loaded into memory all at once. I used to hold all my data in generic TList containers, ordered by ID. Now I can't do that, so I'm using TDictionary<integer, data object> descendants instead, backed by datasets.<br /><br />I had a method on the list class called FirstWhere, which takes an anonymous method and returns the first item that matches the criteria. (See FirstWhere in Alex Ciobanu's Enex; I'm the one who gave him the idea for that method.)<br /><br />But you can't exactly do that on a TDictionary, especially one without all the elements populated. And you can't use a normal anonymous method to query the dataset that's backing the dictionary, so I reimplemented FirstWhere as taking a TLambda-style expression, then generating SQL from it to apply to the dataset as a Filter, and it worked.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1532151022505671498.post-86736439334820909112011-06-21T11:20:38.775+02:002011-06-21T11:20:38.775+02:00I am very curious to know what that was, how you s...I am very curious to know what that was, how you solved it and if you ran into any problems or bugs :)Stefan Glienkehttps://www.blogger.com/profile/09320735081289619570noreply@blogger.comtag:blogger.com,1999:blog-1532151022505671498.post-37901480525896699062011-06-20T22:58:14.316+02:002011-06-20T22:58:14.316+02:00OK, this is sweet. I ran across this article a ju...OK, this is sweet. I ran across this article a just a couple weeks ago, and then today I had a problem that could be solved best with expression trees.<br /><br />Keep up the good work! :)Anonymousnoreply@blogger.com