GithubHelp home page GithubHelp logo

Comments (21)

Kalimehtar avatar Kalimehtar commented on June 30, 2024

I would save current API. such as

(defmacro call (&rest args)
   (if (listp (car args))
       `(gcall (nget ,@(car args)) ,@cdr args)
       `(nget ,@args)))

from cl-gobject-introspection.

andy128k avatar andy128k commented on June 30, 2024

IMHO gcall sounds ugly. What about "invoke"?

from cl-gobject-introspection.

hying-caritas avatar hying-caritas commented on June 30, 2024

I am not good at naming, because I am not good at English. I will accept your naming suggestion. What about "nget"? Do you think it is a good name?

from cl-gobject-introspection.

andy128k avatar andy128k commented on June 30, 2024

nget is supposed to return wrapper for an introspection object, which is derived from GIBaseInfo. What about "info"?

from cl-gobject-introspection.

andy128k avatar andy128k commented on June 30, 2024

Since we discuss interface changes, I would propose to add "property", "(setf property)", "field", "(setf field)" similar to "gcall".

Exclamation mark in setter is nice but too schemish :)

What do you think?

from cl-gobject-introspection.

andy128k avatar andy128k commented on June 30, 2024

@Kalimehtar Should we really keep current API? We could move such code to extra package (gir-compat).

from cl-gobject-introspection.

hying-caritas avatar hying-caritas commented on June 30, 2024

On Tue, Apr 15, 2014 at 7:18 PM, Andrey Kutejko [email protected]:

nget is supposed to return wrapper for an introspection object, which is
derived from GIBaseInfo. What about "info"?

Sometimes not wrapper for an introspection object. For example

(nget gtk "WindowType" :toplevel)

Will return a fixnum.

from cl-gobject-introspection.

hying-caritas avatar hying-caritas commented on June 30, 2024

Since we discuss interface changes, I would propose to add "property", "(setf property)", "field", "(setf field)" similar to "gcall".

Exclamation mark in setter is nice but too schemish :)

What do you think?

Sounds good for me.

from cl-gobject-introspection.

Kalimehtar avatar Kalimehtar commented on June 30, 2024

Should we really keep current API

I'm not so about compat, but about omit extra parens.
There should be handy API for user. (nget ...)-style is good for higher order functions. But for me

window.add(gtk.label.new("ok"))

should be

(call window 'add (call gtk 'label 'new "ok"))

or even (we may make a macro, that quote name for method or class)

(@ window add (@ gtk label new "ok"))

and should not be

(call (nget window add) (call (nget gtk label new) "ok"))

from cl-gobject-introspection.

hying-caritas avatar hying-caritas commented on June 30, 2024

and should not be

(call (nget window add) (call (nget gtk label new) "ok"))

We can make this a little better:

(gcall (window add) (gcall (gtk label new) "ok")

But it is still 2 more pairs parens than your version.

from cl-gobject-introspection.

andy128k avatar andy128k commented on June 30, 2024

Just for inspiration: http://clojuredocs.org/clojure_core/clojure.core/-%3E http://clojuredocs.org/clojure_core/clojure.core/-%3E%3E

from cl-gobject-introspection.

hying-caritas avatar hying-caritas commented on June 30, 2024

For me, -> is a good replacement for "nget", especially I have seen it used in similar way in C/C++/perl.

from cl-gobject-introspection.

andy128k avatar andy128k commented on June 30, 2024

-> is (can be) more general than nget.

(-> *gtk*
    "Button"
    (invoke 'new 0))

from cl-gobject-introspection.

Kalimehtar avatar Kalimehtar commented on June 30, 2024

-> is (can be) more general than nget

And cannot be used in mapcar, for example. -> is a good macro, but bad base API.

from cl-gobject-introspection.

hying-caritas avatar hying-caritas commented on June 30, 2024

I think we can start with the stuff we have consensus firstly. That is, Add "nget", "gcall", and keep "call" at least for now. We can add "->" in the future based on "nget" and "gcall".

As for naming, the formal name of "gcall" will be "invoke", but I don't think "info" is good replacement for "nget", any suggestion?

from cl-gobject-introspection.

Kalimehtar avatar Kalimehtar commented on June 30, 2024

any suggestion

I'm agree with it. So add "nget" and "invoke" and replace "call" with a macro.
This way we will have an opportunity to change internal presentation for repository and objects from lambdas to structs.

from cl-gobject-introspection.

andy128k avatar andy128k commented on June 30, 2024

I personally don't like than nget has special case for enum values. Enum value is a GIValueInfo. This fits to "info".

One more thing. I am not sure somebody needs raw integer value for enum/bitfield.
But "invoke" can take both GIValueInfo and fixnum.

from cl-gobject-introspection.

hying-caritas avatar hying-caritas commented on June 30, 2024

One more thing. I am not sure somebody needs raw integer value for enum/bitfield.

I think raw integer is better for readability. And we finally need the raw integer value to fill in function argument.

And not only the enum, we need raw integer and string for const too.

from cl-gobject-introspection.

hying-caritas avatar hying-caritas commented on June 30, 2024

On Tue, Apr 15, 2014 at 5:01 PM, Kalimehtar [email protected]:

I would save current API. such as

(defmacro call (&rest args)
(if (listp (car args))
(gcall (nget ,@(car args)) ,@cdr args) (nget ,@Args)))

It appears that this will not keep original "call" syntax exactly.

Originally, it is:

(call gtk "Window" 'new 0)

With your macro, it will be:

(call (gtk "Window" 'new) 0)

I want to double check is this what you want? Because if appears to keep
originally "call", we need to convert everything except function to struct
firstly.

from cl-gobject-introspection.

Kalimehtar avatar Kalimehtar commented on June 30, 2024

Oh. I failed.
Then drop "call". New API is better.

from cl-gobject-introspection.

hying-caritas avatar hying-caritas commented on June 30, 2024

OK. And I will keep using "nget" until we find a better name.

from cl-gobject-introspection.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.