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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).