Comments (21)
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.
IMHO gcall sounds ugly. What about "invoke"?
from cl-gobject-introspection.
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.
nget is supposed to return wrapper for an introspection object, which is derived from GIBaseInfo. What about "info"?
from cl-gobject-introspection.
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.
@Kalimehtar Should we really keep current API? We could move such code to extra package (gir-compat).
from cl-gobject-introspection.
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.
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.
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.
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.
Just for inspiration: http://clojuredocs.org/clojure_core/clojure.core/-%3E http://clojuredocs.org/clojure_core/clojure.core/-%3E%3E
from cl-gobject-introspection.
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.
-> is (can be) more general than nget.
(-> *gtk*
"Button"
(invoke 'new 0))
from cl-gobject-introspection.
-> 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.
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.
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.
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.
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.
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.
Oh. I failed.
Then drop "call". New API is better.
from cl-gobject-introspection.
OK. And I will keep using "nget" until we find a better name.
from cl-gobject-introspection.
Related Issues (20)
- Create structure w/o constructor HOT 3
- Where is definition of "repository" function or macro? HOT 1
- example in /test/hello.lisp doesn't work HOT 4
- The widget method get_allocation generates an error when called (on a DrawingArea, at least) HOT 20
- COMMON-LISP:DIVISION-BY-ZERO in maze example if usb mouse is used HOT 2
- Build failure with quicklisp HOT 1
- Tests fail with TODO ARRAY HOT 2
- Web view not displaying in box HOT 2
- Can we use lambda/closures for GAsyncReadyCallback? HOT 4
- Fetching GAsyncResult from run-javascript HOT 10
- Problem loading Shared Library HOT 1
- test system doesn't build HOT 1
- Saving core images with variables bound to the result of `require-namespace` does not work. HOT 4
- repository-get-search-path should not free the returned GSList pointer
- Function call wrongly returns NIL when ownership stays with the foreign part of the code HOT 1
- Can gdk_atom_intern be accessed with cl-gobject-introspection? HOT 1
- List in signal parameter is not handled correctly
- Please advice if there is a better way to assert object class
- Radio buttons HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cl-gobject-introspection.