Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do_ could be renamed to do #42

Open
oliverjanik opened this issue Apr 18, 2016 · 2 comments
Open

Do_ could be renamed to do #42

oliverjanik opened this issue Apr 18, 2016 · 2 comments

Comments

@oliverjanik
Copy link

do_ method in java only has underscore because it conflicts with the keyword, right? With the capitalization C# does not have this probelm

@deontologician
Copy link

This would probably require the C# driver to re-implement some of the logic currently done in the Java driver's python code. That's where the mapping from reql terms to method names happens. I think RethinkDb.Driver uses only the output of that process, java_term_info.json.

For reference, the mapping of keywords happens here: https://github.com/rethinkdb/rethinkdb/blob/next/drivers/java/metajava.py#L143

You could easily modify metajava.py to have an empty JAVA_KEYWORDS array

@bchavez
Copy link
Owner

bchavez commented Apr 18, 2016

Echoing everything the masterful @deontologician said.

Just a small addition: We do a tiny itsy-bitsy bit processing on top of java_term_info.json in CSharpTermInfoMutator.cs as a safety and sanity check. IIRC, there was one or two keywords that caused the C# compiler to freak out.

The C# driver still needs the Java's do_ because the C# driver has a temporary and internal Java API compatibility layer that forwards Java naming AST calls to the primary C# naming AST. This internal layer is needed for maintaining compatibility with the Java unit tests. Also see: #18 (comment) [paragraph Regarding No.1]

Here's an example:

public Funcall Do_ ( Javascript js )
{
    Arguments arguments = new Arguments();
    arguments.CoerceAndAdd(js);
    return new Funcall (arguments);
}
internal Funcall do_ ( Javascript js )
{
   return Do_ ( js );
}

I think writing code to maintain special cases for Do and do_ would add complexity at the moment. Also, the benefit of keeping compatibility with Java's unit tests is too huge for us to remove right now.

Eventually, we'll be able to remove the internal Java API compatibility layer soon as (IIRC) rethinkdb/rethinkdb#5003 is done. Once rethinkdb/rethinkdb#5003 is done, I think we'll use a csharp_coverter.py to generate C# unit tests using @deontologician 's multireql tool. Once we have these two items, we can go back and remove the Do_ do_ 💩 and just win with Do 🏆 . The internal Java API compatibility layer won't be needed anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants