unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* no scm_foreign_object_p ?
@ 2021-01-23 18:58 Matt Wette
  2021-01-23 19:29 ` olivier.dion--- via General Guile related discussions
  0 siblings, 1 reply; 4+ messages in thread
From: Matt Wette @ 2021-01-23 18:58 UTC (permalink / raw)
  To: Guile User

I started using foreign objects but want something akin to number?, 
string? etc.
Is there something that works here?
I was hoping to see scm_foreign_object_p(type, object).




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: no scm_foreign_object_p ?
  2021-01-23 18:58 no scm_foreign_object_p ? Matt Wette
@ 2021-01-23 19:29 ` olivier.dion--- via General Guile related discussions
  2021-01-23 20:04   ` divoplade
  0 siblings, 1 reply; 4+ messages in thread
From: olivier.dion--- via General Guile related discussions @ 2021-01-23 19:29 UTC (permalink / raw)
  To: Matt Wette, Guile User

On Sat, 23 Jan 2021, Matt Wette <matt.wette@gmail.com> wrote:
> I started using foreign objects but want something akin to number?, 
> string? etc.
> Is there something that works here?
> I was hoping to see scm_foreign_object_p(type, object).

The only thing I see in the manual is `scm_assert_foreign_object_type`.

For something equivalent in scheme, I guess you could do something like:
----------------------------------------------------------------------
(define (foreign? obj)
  (not (or (number? obj)
           (string? obj)
           (null? obj)
           ;; and so on..
           )))
----------------------------------------------------------------------

I agree that such predicate should be part of the buitlin API.

-- 
Olivier Dion
PolyMtl



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: no scm_foreign_object_p ?
  2021-01-23 19:29 ` olivier.dion--- via General Guile related discussions
@ 2021-01-23 20:04   ` divoplade
  2021-01-23 20:52     ` Matt Wette
  0 siblings, 1 reply; 4+ messages in thread
From: divoplade @ 2021-01-23 20:04 UTC (permalink / raw)
  To: Olivier Dion, Matt Wette, Guile User

Hello,

Le samedi 23 janvier 2021 à 14:29 -0500, olivier.dion--- via General
Guile related discussions a écrit :
> On Sat, 23 Jan 2021, Matt Wette <matt.wette@gmail.com> wrote:
> > I started using foreign objects but want something akin to
> > number?, 
> > string? etc.
> > Is there something that works here?
> > I was hoping to see scm_foreign_object_p(type, object).
> 
> The only thing I see in the manual is
> `scm_assert_foreign_object_type`.
That's what I noticed too; if you want something finer you need to
write scheme code.

Since foreign pointers are GOOPS objects and foreign pointer types are
classes, maybe the is-a? predicate could work, with the foreign pointer
type as the class?

divoplade




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: no scm_foreign_object_p ?
  2021-01-23 20:04   ` divoplade
@ 2021-01-23 20:52     ` Matt Wette
  0 siblings, 0 replies; 4+ messages in thread
From: Matt Wette @ 2021-01-23 20:52 UTC (permalink / raw)
  To: guile-user


On 1/23/21 12:04 PM, divoplade wrote:
> Hello,
>
> Le samedi 23 janvier 2021 à 14:29 -0500, olivier.dion--- via General
> Guile related discussions a écrit :
>> On Sat, 23 Jan 2021, Matt Wette <matt.wette@gmail.com> wrote:
>>> I started using foreign objects but want something akin to
>>> number?,
>>> string? etc.
>>> Is there something that works here?
>>> I was hoping to see scm_foreign_object_p(type, object).
>> The only thing I see in the manual is
>> `scm_assert_foreign_object_type`.
> That's what I noticed too; if you want something finer you need to
> write scheme code.
>
> Since foreign pointers are GOOPS objects and foreign pointer types are
> classes, maybe the is-a? predicate could work, with the foreign pointer
> type as the class?
>
> divoplade
>
>

GOOPS should not be part of the solution.  I'm thinking of punting 
foreign-object
and see if using some combination of structs and bytevectors will work 
out better.




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-01-23 20:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-23 18:58 no scm_foreign_object_p ? Matt Wette
2021-01-23 19:29 ` olivier.dion--- via General Guile related discussions
2021-01-23 20:04   ` divoplade
2021-01-23 20:52     ` Matt Wette

unofficial mirror of guile-user@gnu.org 

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://yhetil.org/guile-user/0 guile-user/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 guile-user guile-user/ https://yhetil.org/guile-user \
		guile-user@gnu.org
	public-inbox-index guile-user

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.lisp.guile.user
	nntp://news.gmane.io/gmane.lisp.guile.user


AGPL code for this site: git clone http://ou63pmih66umazou.onion/public-inbox.git