andy128k / cl-gobject-introspection

BSD 2-Clause "Simplified" License
49 stars 15 forks source link

Null pointer #13

Closed hying-caritas closed 10 years ago

hying-caritas commented 10 years ago

Null pointer processing and argv utility functions.

Kalimehtar commented 10 years ago

Are you sure? I mean: why NIL is better than CFFI:NULL-POINTER ?

hying-caritas commented 10 years ago

IMHO, NIL is the lisp translation of CFFI:NULL-POINTER, so that the user can be more lispy. Just like in foreign-string-to-lisp, if input parameter is CFFI:NULL-POINTER, the return value will be NIL.

Kalimehtar commented 10 years ago

foreign-string-to-lisp has signature (cffi:pointer -> (or string null)). It returns NIL for null pointer, because empty string and null string differs.

giarg->pointer has signature (giarg struct -> cffi:pointer). I don't see, why one should make it (giarg struct -> (or cffi:pointer null)).

hying-caritas commented 10 years ago

OK. I see. For giarg->pointer and pointer->giarg, it seems not good to replace CFFI:NULL-POINTER with NIL.

But for string and struct/object, I still think it is reasonable to use nil. That is, if we translate the value between pointer and lisp, we will always use lisp value: string/struct/object/nil; if we don't translate, we always use raw pointer, including null-pointer. Do you agree?

Kalimehtar commented 10 years ago

Yes, agree. Please make new pull request