You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucy.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2015/05/04 03:01:06 UTC

[lucy-issues] [jira] [Commented] (CLOWNFISH-32) Autogenerate Go binding code

    [ https://issues.apache.org/jira/browse/CLOWNFISH-32?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14526126#comment-14526126 ] 

ASF GitHub Bot commented on CLOWNFISH-32:
-----------------------------------------

GitHub user rectang opened a pull request:

    https://github.com/apache/lucy-clownfish/pull/14

    CLOWNFISH-32 Autogenerate go bindings v2

    Autogenerate Go bindings: wrappers for each method, plus struct, interface and helper functions for each class.
    
    This pull request improves on the first iteration by substantially shrinking the size of generated code.  The branch has also been rebased on a later version of master and incorporates the "v4" proof-of-concept changes.  See this [diff of diffs](https://gist.github.com/rectang/ffbcb7be7f920580c819) for how this pull request differs from v1.
    
    This fixes CLOWNFISH-32.
    


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/rectang/lucy-clownfish CLOWNFISH-32-autogen-go-v2

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/lucy-clownfish/pull/14.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #14
    
----
commit e0d6b8053ec671d67558ef26a980bcdd598e9b7e
Author: Marvin Humphrey <ma...@rectangular.com>
Date:   2015-04-28T01:51:10Z

    Modify Go proof-of-concept design.
    
    *   Make structs public: `FooIMP` instead of `implFoo`.
    *   Embed parent structs.
    *   Make `ref` a `uintptr` instead of a pointer to a C type.
    *   Add the INITOBJ method to ObjIMP.
    *   Use one finalizer and call SetFinalizer from only one location.
    *   Implement TOPTR() only once.

commit 8c54208d1dbadce233b7e0d179ee8f3d8f6077d2
Author: Marvin Humphrey <ma...@rectangular.com>
Date:   2015-03-29T22:02:38Z

    Determine Go package from Clownfish parcel.

commit 3ace9119bb8c3a2d0cfe14fa96aada7eebaee04b
Author: Marvin Humphrey <ma...@rectangular.com>
Date:   2015-03-23T19:06:24Z

    Start autogenerating Go binding code.

commit 323074ef5d33ca609952ab7f135f06e893b73e2d
Author: Marvin Humphrey <ma...@rectangular.com>
Date:   2015-03-24T00:52:09Z

    Add CFCGoClass: Go bindings for a Clownfish Class.

commit d3d3eca18bf280fe3e0f29006f7d75da4db47805
Author: Marvin Humphrey <ma...@rectangular.com>
Date:   2015-03-29T22:04:53Z

    Autogenerate Go type statements for classes.
    
    All non-inert classes get both a public interface type and a public
    struct type.

commit b28f7068cccc6af37b532c8d6221f381c66258cf
Author: Marvin Humphrey <ma...@rectangular.com>
Date:   2015-04-07T03:12:00Z

    Add CFCGoMethod.

commit c610815d90cf88ab08607e1b39ddcc4e2562d9aa
Author: Marvin Humphrey <ma...@rectangular.com>
Date:   2015-04-07T03:18:18Z

    Enable method binding generation by CFCGoClass.

commit 74c63ee393fa1df2b611559dd61099e48ab0a752
Author: Marvin Humphrey <ma...@rectangular.com>
Date:   2015-03-30T04:21:45Z

    Add accessor for client to CFCGoClass.

commit 7bc053ecfb08593c0491178c3afe830bf6b6508b
Author: Marvin Humphrey <ma...@rectangular.com>
Date:   2015-04-01T00:14:33Z

    Autogenerate per-Class Go helper func.
    
    Just one for now: `WRAPFoo`.

commit ab96aa952b8f60a18743abb8eb815fdd95b06172
Author: Marvin Humphrey <ma...@rectangular.com>
Date:   2015-04-07T03:11:42Z

    Autogenerate CGO method bindings.

commit 97692032c034720c235c8466c161fd9da5f79486
Author: Marvin Humphrey <ma...@rectangular.com>
Date:   2015-04-01T23:57:58Z

    Brute normalization of method signatures for Go.
    
    *   Pass invoker to Go method glue generation.
    *   Use novel method invocation function.
    *   For co-variant return types, the Go bindings always return the
        lowest common denominator from the novel method.  This is
        necessary because a method with a co-variant return type does not
        satisfy a Go interface.

commit 8ec3abfb50a4b3074d8e1303f56dd9774bf39c95
Author: Marvin Humphrey <ma...@rectangular.com>
Date:   2015-04-03T18:37:48Z

    Flesh out Go interfaces.

commit d59386b56b758bcb7449591f8643b4b879b19cea
Author: Marvin Humphrey <ma...@rectangular.com>
Date:   2015-04-08T22:03:41Z

    Use idiomatic Go argument names when possible.
    
    *   Single-letter method receievers.
    *   lowerCamelCase for parameters.

commit b755bd4bf132fa11f2b559fb407f68a3dba0420d
Author: Marvin Humphrey <ma...@rectangular.com>
Date:   2015-04-09T22:45:59Z

    Allow suppression of autogenerated Go init().
    
    Bootstrapping is a problem when there are multiple init() functions
    because the order in which they run is not defined.  Therefore, allow
    the user to suppress the autogenerated init and perform bootstrapping in
    their own init() function.

commit ff3b0444cd8100987f70966e34b79eb43d0977c7
Author: Marvin Humphrey <ma...@rectangular.com>
Date:   2015-04-10T01:21:38Z

    Generate Go imports for prereq parcels.
    
    When Clownfish parcels depend on other parcels, we need to generate a Go
    import statement for each dependency to insert into the autogenerated Go
    code.

commit 879b731635f9ec4f673cb06de70d16c53b0e59ff
Author: Marvin Humphrey <ma...@rectangular.com>
Date:   2015-04-10T02:02:47Z

    Disallow Go keywords as param names.
    
    Append an underscore to the end -- e.g. for the param `type`,
    substitute `type_`.  It's ugly and not Go style, but it's bulletproof
    because we it will never clash with lowerCamelCase.

commit 1317fb092246b7911c1ce294d86aaeae3abdc22b
Author: Marvin Humphrey <ma...@rectangular.com>
Date:   2015-04-10T02:46:49Z

    Publish abstract method backing functions.
    
    Declare the implementing functions for abstract methods.  Have the
    implementations match the method signatures rather than abuse C function
    pointer casting.
    
    Having implementing functions hidden was a latent bug: the method
    invocation symbol for a `final` class which fails to implement the
    method is a macro alias for the implementing func, and if such a method
    were ever used in source code, the symbol would have been missing at
    link time.

commit 3106bce8e38c5691bed243574d7d0ab40e2e1892
Author: Marvin Humphrey <ma...@rectangular.com>
Date:   2015-04-10T02:55:08Z

    Use IMP func for final method call from Go.
    
    CGO can't deal with macros, and for a final method which is also novel,
    the method invocation symbol is a macro which resolves to the
    implementing function.  Use the implementing function instead of the
    macro alias so that CGO doesn't choke.

commit 4af1278207063df568fb3c04a72aa5e6a1097952
Author: Marvin Humphrey <ma...@rectangular.com>
Date:   2015-04-12T16:07:54Z

    Make CFCGoClass available via CFC Go bindings.

commit d6651b9facc1ea846bd9a76375eb6c1661092d6c
Author: Marvin Humphrey <ma...@rectangular.com>
Date:   2015-04-12T16:09:31Z

    Lazy load class when fetched from Go binding.

commit a1507525bbe0c65914b00c47250f37c2c95c2337
Author: Marvin Humphrey <ma...@rectangular.com>
Date:   2015-04-12T16:24:13Z

    Enable customized Go method bindings.
    
    Allow Clownfish methods to be bound to Go using custom signatures, and
    allow arbitrary methods to be added.  In both cases, the expectation is
    that the user will supply the implementation code, as customizing the
    signature disables autogenerating the default binding (which would
    presumably not match the custom signature).

commit 31f73534dfb055941eb60b541340a26cad230202
Author: Marvin Humphrey <ma...@rectangular.com>
Date:   2015-05-03T18:17:46Z

    Allow custom Go wrapper struct defs.
    
    Suppress the autogenerated go struct type definition, so that a custom
    defined one won't clash.

commit 7c4732abb064e405b8fbb8596995975b0dc6b324
Author: Marvin Humphrey <ma...@rectangular.com>
Date:   2015-05-03T23:36:59Z

    Final classes mean final methods.
    
    All dynamic methods in a final class must be final.
    
    Prior to this commit, CFCClass_fresh_methods would return non-finalized
    methods, though CFCClass_methods would return methods which had been
    properly finalized.

----


> Autogenerate Go binding code
> ----------------------------
>
>                 Key: CLOWNFISH-32
>                 URL: https://issues.apache.org/jira/browse/CLOWNFISH-32
>             Project: Apache Lucy-Clownfish
>          Issue Type: Improvement
>            Reporter: Marvin Humphrey
>            Assignee: Marvin Humphrey
>
> Take the proof-of-concept hand-coded bindings from CLOWNFISH-28 and replace them with autogenerated code whenever possible.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)