queryverse / Query.jl

Query almost anything in julia
Other
396 stars 50 forks source link

MacroTools #198

Closed bramtayl closed 3 years ago

bramtayl commented 6 years ago

I'm saving the real surgery for later but this is definitely a start

davidanthoff commented 6 years ago

Great! I think first step would be to make sure all tests pass, there seems to be some issue on 0.7?

bramtayl commented 6 years ago

Yup dunno I'll look into that

bramtayl commented 6 years ago

Ok so here's my current thoughts.

1) LightQuery is up and functional (as of yet unpublished). 2) Using LightQuery with QueryOperators requires either new methods or slight tweaks in the format arguments are passed in. 3) LightQuery.@query from LightQuery plus QueryOperators should be able to fully replace the stand-alone macros. 4) @from parsing would remain only for backwards compatibility, and would essentially change the code to something that could be processed by LightQuery@query.

What do you think?

davidanthoff commented 5 years ago

@bramtayl Do you think you will be able to fix the test errors here anytime soon? It would be great to merge this, and I was just wondering about project planning here :)

bramtayl commented 5 years ago

I could possibly revive this, though I'd have to get 0.7 set up again. I was hoping that the work I did on LightQuery would give me some insight on what to do here. How would you feel about:

a) Adding ::Nameless methods to QueryOperators b) Moving the two macros from LightQuery into here and c) Having @from basically translate everything from a LINQ query into a LightQuery?

davidanthoff commented 5 years ago

I could possibly revive this, though I'd have to get 0.7 set up again.

I think I figured that one out, so no need to spend time on that!

I was hoping that the work I did on LightQuery would give me some insight on what to do here.

Yes, that sounds like a great strategy!

a) Adding ::Nameless methods to QueryOperators

Yes, I think that makes a lot of sense. It would essentially mean that we would replace the two args that we have right now in all the functions with only one arg, and that would have to be of the type Nameless, right? So we need to make sure that we phase that in, because we will also need a synced release of Query.jl, but in general I think that would make things much cleaner.

I'm not so sure about the name Nameless, though... Somehow that doesn't seem to capture what that type is... Maybe FunctionWithExpr?? Or something like that? I think maybe we should go with a more descriptive approach, not necessarily the shortest one? Or maybe it doesn't matter that much, given that end users won't ever see this...

b) Moving the two macros from LightQuery into here and c) Having @from basically translate everything from a LINQ query into a LightQuery?

I'm of two minds on that :) So in general, I would like to not break things that work right now. I think that wouldn't be an issue for the LINQ style syntax, because for that this would all just be under the hood. The standalone versions though I also don't want to break. So then the question becomes: should we add another, third option to Query.jl? I'm genuinely not sure right now, given that there also seems to be some efforts in base around this topic, which might result in yet another option... Or were you just thinking to use that as an internal step for now? I think ideally we would think about this a little longer? I just don't have a clear opinion right now...

What about the following strategy:

bramtayl commented 5 years ago

Sure that sounds good

bramtayl commented 5 years ago

I chose the name Nameless because anonymous means nameless in Latin, but I'd be ok with calling it whatever. Despite thinking about it for a long time I continually come up with new ideas for chaining and lazycalling so take them with a grain of salt

davidanthoff commented 5 years ago

We'll need to make sure that the things in https://github.com/queryverse/Query.jl/pull/216 make it into this PR here as well.