You're right, I was thinking about dynamic methods. (Sorry, I've been distracted lately, not thinking straight.) Let's go with Reflection.Emit.
Paul Irwin Lead Software Engineer feature[23] Email: [email protected] Cell: 863-698-9294 On Tue, Jan 6, 2015 at 10:01 PM, Hakeem Mohammed <[email protected]> wrote: > Hi Paul, > > As you might be aware, Expression trees can't generate dynamic types which > is what is being done in Java. The types that were generated are created as > subclasses of the Expressions class in Lucene.Net.Expressions. The only > options that I'm aware of creating and executing dynamic types are CodeDOM, > Reflection.Emit and Roslyn. I have zero experience in Roslyn and CodeDOM is > very slow. We do get a little bit of compile-time safety using OpCodes > > On Tue, Jan 6, 2015 at 11:18 AM, Paul Irwin <[email protected]> wrote: > > > Sorry about the ambiguity in my previous post. > > > > In reference to this comment: "the asm library was used to create java > > classes out of the bytecode. They probably did it that way because the > > generated types needed to be subclassed from the Expression type. We > could > > use Reflection.Emit instead" - if possible, if we're generating dynamic > > types or methods at runtime, we should try to use > *System.Linq.Expressions* > > instead of Reflection.Emit to do that. It gives you compile-time safety, > > whereas Reflection.Emit has no compile-time safety. > > > > > > Paul Irwin > > Lead Software Engineer > > feature[23] > > > > Email: [email protected] > > Cell: 863-698-9294 > > > > On Tue, Jan 6, 2015 at 11:13 AM, Itamar Syn-Hershko <[email protected]> > > wrote: > > > > > By Expressions we mean Lucene Expressions, see > > > > > > > > > https://github.com/apache/lucene-solr/tree/trunk/lucene/expressions/src/java/org/apache/lucene/expressions > > > > > > Its based on Antlr, but Hakeems says they are doing some additional > funky > > > stuff. > > > > > > What were you suggesting? > > > > > > -- > > > > > > Itamar Syn-Hershko > > > http://code972.com | @synhershko <https://twitter.com/synhershko> > > > Freelance Developer & Consultant > > > Author of RavenDB in Action <http://manning.com/synhershko/> > > > > > > On Tue, Jan 6, 2015 at 6:09 PM, Paul Irwin <[email protected]> > wrote: > > > > > > > As of .NET 4, it is preferable to use Expressions over > Reflection.Emit > > > due > > > > to compile-time safety that helps prevent run-time errors (like > > crashing > > > > the CLR, which I've totally done with Reflection.Emit before), since > > .NET > > > > 4+ includes nearly-complete Expression support that can be used to > > build > > > > just about any function. I'd definitely prefer Expressions to > > > > Reflection.Emit. Or am I misunderstanding something? (Sorry, haven't > > been > > > > able to dive into the code lately, but trying to stay on top of the > > > > emails.) > > > > > > > > > > > > Paul Irwin > > > > Lead Software Engineer > > > > feature[23] > > > > > > > > Email: [email protected] > > > > Cell: 863-698-9294 > > > > > > > > On Tue, Jan 6, 2015 at 8:45 AM, Itamar Syn-Hershko < > [email protected] > > > > > > > wrote: > > > > > > > > > As long as the tests are green and implementation makes sense, I'm > > good > > > > > with that. At least for this first phase. > > > > > > > > > > -- > > > > > > > > > > Itamar Syn-Hershko > > > > > http://code972.com | @synhershko <https://twitter.com/synhershko> > > > > > Freelance Developer & Consultant > > > > > Author of RavenDB in Action <http://manning.com/synhershko/> > > > > > > > > > > On Tue, Jan 6, 2015 at 3:41 PM, Hakeem Mohammed < > > [email protected]> > > > > > wrote: > > > > > > > > > > > They have used the classwriter and Genadaptor to generate types > > from > > > > > > bytecode. So the design is string expressions are tokenized, > > > bytecodes > > > > > were > > > > > > genned from the tokenized byte arrays and then the asm library > was > > > used > > > > > to > > > > > > create java classes out of the bytecode. They probably did it > that > > > way > > > > > > because the generated types needed to be subclassed from the > > > Expression > > > > > > type. We could use Reflection.Emit instead. But do let me know if > > you > > > > > have > > > > > > any other ideas > > > > > > > > > > > > > > > > > > > > > > > > On Mon, Jan 5, 2015 at 11:37 PM, Itamar Syn-Hershko < > > > > [email protected]> > > > > > > wrote: > > > > > > > > > > > > > It is an overkill. What did they use asm for? All you need to > > port > > > > > > > Expressions is Antlr really > > > > > > > > > > > > > > -- > > > > > > > > > > > > > > Itamar Syn-Hershko > > > > > > > http://code972.com | @synhershko < > https://twitter.com/synhershko > > > > > > > > > > Freelance Developer & Consultant > > > > > > > Author of RavenDB in Action <http://manning.com/synhershko/> > > > > > > > > > > > > > > On Mon, Jan 5, 2015 at 3:08 PM, Hakeem Mohammed < > > > > [email protected]> > > > > > > > wrote: > > > > > > > > > > > > > > > Yes the Java impl is using Antlr already, but they also used > > the > > > > asm > > > > > > > > library. That is where I'm debating whether to use Expression > > > trees > > > > > or > > > > > > go > > > > > > > > for Roslyn. The latter looks like a bit of overkill though > > > > > > > > > > > > > > > > On Sun, Jan 4, 2015 at 11:22 AM, Itamar Syn-Hershko < > > > > > > [email protected]> > > > > > > > > wrote: > > > > > > > > > > > > > > > > > Yes, the tokenizer implementations > > > > > > > > > > > > > > > > > > -- > > > > > > > > > > > > > > > > > > Itamar Syn-Hershko > > > > > > > > > http://code972.com | @synhershko < > > > https://twitter.com/synhershko > > > > > > > > > > > > > > Freelance Developer & Consultant > > > > > > > > > Author of RavenDB in Action < > http://manning.com/synhershko/> > > > > > > > > > > > > > > > > > > On Sun, Jan 4, 2015 at 6:19 PM, Paul Irwin < > > > [email protected] > > > > > > > > > > > > wrote: > > > > > > > > > > > > > > > > > > > Ah, I thought there was some place they were using > another > > > > parser > > > > > > > > > > generator, but in the case of Antlr grammar already > there, > > > have > > > > > at > > > > > > > it. > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Paul Irwin > > > > > > > > > > Lead Software Engineer > > > > > > > > > > feature[23] > > > > > > > > > > > > > > > > > > > > Email: [email protected] > > > > > > > > > > Cell: 863-698-9294 > > > > > > > > > > > > > > > > > > > > On Sun, Jan 4, 2015 at 11:14 AM, Itamar Syn-Hershko < > > > > > > > > [email protected]> > > > > > > > > > > wrote: > > > > > > > > > > > > > > > > > > > > > They are using Antlr for generating the Java bits there > > > > > anyway.. > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > > > > > > > > > > > > > > > > Itamar Syn-Hershko > > > > > > > > > > > http://code972.com | @synhershko < > > > > > https://twitter.com/synhershko > > > > > > > > > > > > > > > > > > Freelance Developer & Consultant > > > > > > > > > > > Author of RavenDB in Action < > > > http://manning.com/synhershko/> > > > > > > > > > > > > > > > > > > > > > > On Sun, Jan 4, 2015 at 6:05 PM, Paul Irwin < > > > > > [email protected] > > > > > > > > > > > > > > > > wrote: > > > > > > > > > > > > > > > > > > > > > > > I'd caution against reinventing the wheel on the > > parsing > > > > > right > > > > > > > now. > > > > > > > > > It > > > > > > > > > > > may > > > > > > > > > > > > be a faster path to just convert the generated java > > > parsers > > > > > > into > > > > > > > C# > > > > > > > > > > using > > > > > > > > > > > > an automated tool, as I did on my earlier Lucene 4.3 > > > > porting > > > > > > so I > > > > > > > > can > > > > > > > > > > > > attest to it. I was able to validate that they parsed > > > > > correctly > > > > > > > and > > > > > > > > > > even > > > > > > > > > > > > used that ported code in a production app. Rewriting > a > > > > parser > > > > > > may > > > > > > > > not > > > > > > > > > > be > > > > > > > > > > > > the best use of time right now -- although I can > > > certainly > > > > > see > > > > > > > the > > > > > > > > > > value > > > > > > > > > > > in > > > > > > > > > > > > doing so later on. > > > > > > > > > > > > > > > > > > > > > > > > You can use my little utility to convert the syntax > of > > > > entire > > > > > > > files > > > > > > > > > at > > > > > > > > > > > > once: https://github.com/paulirwin/javatocsharp > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Paul Irwin > > > > > > > > > > > > Lead Software Engineer > > > > > > > > > > > > feature[23] > > > > > > > > > > > > > > > > > > > > > > > > Email: [email protected] > > > > > > > > > > > > Cell: 863-698-9294 > > > > > > > > > > > > > > > > > > > > > > > > On Sat, Jan 3, 2015 at 6:27 PM, Hakeem Mohammed < > > > > > > > > > [email protected]> > > > > > > > > > > > > wrote: > > > > > > > > > > > > > > > > > > > > > > > > > Thanks Itamar and Laimonas. I appreciate the > details > > > and > > > > > glad > > > > > > > to > > > > > > > > > help > > > > > > > > > > > . I > > > > > > > > > > > > > got started on Expressions and half way there. I'm > > > using > > > > > > Antlr > > > > > > > > 4.3 > > > > > > > > > > for > > > > > > > > > > > > the > > > > > > > > > > > > > parsing. Please let me know if that is what y'all > > were > > > > > > planning > > > > > > > > to > > > > > > > > > > use > > > > > > > > > > > > > anyway. I'll get to the index tests in core after > > that > > > > > > > > > > > > > > > > > > > > > > > > > > On Sat, Jan 3, 2015 at 1:52 PM, Itamar Syn-Hershko > < > > > > > > > > > > [email protected] > > > > > > > > > > > > > > > > > > > > > > > > > wrote: > > > > > > > > > > > > > > > > > > > > > > > > > > > Hi Hakeem, welcome on board! > > > > > > > > > > > > > > > > > > > > > > > > > > > > Laimonas's response is spot on, let us know if > you > > > have > > > > > any > > > > > > > > > further > > > > > > > > > > > > > > questions. > > > > > > > > > > > > > > > > > > > > > > > > > > > > I personally don't have any preference - once we > > get > > > > to 0 > > > > > > > test > > > > > > > > > > > failures > > > > > > > > > > > > > in > > > > > > > > > > > > > > the core we will concentrate on finishing porting > > the > > > > > rest > > > > > > of > > > > > > > > the > > > > > > > > > > > > > > sub-projects (Analysis.Common, Codecs, Suggest) > > with > > > > all > > > > > > > their > > > > > > > > > > tests, > > > > > > > > > > > > and > > > > > > > > > > > > > > then porting more sub-projects. > > > > > > > > > > > > > > > > > > > > > > > > > > > > So I guess pick whatever you think you'd enjoy > > most, > > > > just > > > > > > > make > > > > > > > > > sure > > > > > > > > > > > to > > > > > > > > > > > > > keep > > > > > > > > > > > > > > us in the loop! > > > > > > > > > > > > > > > > > > > > > > > > > > > > Cheers, > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > > > > > > > > > > > > > > > > > > > > > > Itamar Syn-Hershko > > > > > > > > > > > > > > http://code972.com | @synhershko < > > > > > > > > https://twitter.com/synhershko > > > > > > > > > > > > > > > > > > > > > > > > Freelance Developer & Consultant > > > > > > > > > > > > > > Author of RavenDB in Action < > > > > > > http://manning.com/synhershko/> > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Sat, Jan 3, 2015 at 7:33 PM, Hakeem Mohammed < > > > > > > > > > > > [email protected]> > > > > > > > > > > > > > > wrote: > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Hello, > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > I just joined this group and looking to offer > > some > > > > help > > > > > > in > > > > > > > > > > updating > > > > > > > > > > > > > > Lucene > > > > > > > > > > > > > > > to 4.8. I briefly skimmed thru but could not > find > > > any > > > > > > items > > > > > > > > > > related > > > > > > > > > > > > to > > > > > > > > > > > > > > the > > > > > > > > > > > > > > > 4.x work. I'd very much appreciate it if > someone > > > can > > > > > let > > > > > > me > > > > > > > > > know > > > > > > > > > > > the > > > > > > > > > > > > > > > process for picking up items to work on. I > spent > > a > > > > > couple > > > > > > > > weeks > > > > > > > > > > > > > updating > > > > > > > > > > > > > > an > > > > > > > > > > > > > > > outdated branch of Lucene, so trying to avoid > > that > > > > > > mistake > > > > > > > > > again > > > > > > > > > > :) > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Thanks! > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
