IRC channel logs


back to list of logs

***wleslie_ is now known as wleslie
<paroneayea>dumb question maybe, but is there some kind of (type foo)
<paroneayea>in guile?
<mark_weaver>paroneayea: you want to know the type of some arbitrary object?
<mark_weaver>in scheme, the usual way is to ask whether an object is of a particular type, rather than asking what "the type" is, partly because an object may in general have more than one type.
<mark_weaver>this is most notable in the case of numbers, where all integers are rational, all rationals are real, all reals are complex, and all complex are numbers.
<mark_weaver>so 1 is a member of all of those types.
<mark_weaver>s/all complex/all complex numbers/
<mark_weaver>GOOPS has a 'class-of' procedure, but I wonder what you hope to use it for and whether there's a better way.
<paroneayea>mark_weaver: well, mainly, a function returned something
<paroneayea>and I wanted to see what type it was :)
<nalaginrut>morning guilers~
<paroneayea>hello nalaginrut
<civodul>Hello Guilers!
<davexunit>defining record types can get real repetitive.
<davexunit>I usually want something simple that will make the getters/setters for me without having to explicitly name them
<davexunit>(define-simple-record-type foo (bar baz))
<davexunit>I can't find an existing macro in Guile that does something along these lines.
<taylanub>I was going to recommend SRFI-99, then realized Guile doesn't have it :(
*davexunit looks it up
<taylanub>I haven't looked that much into it, but I've looked into R6RS records, was quite impressed, and SRFI-99 is basically a backwards-compatible cleanup/polish of them
<taylanub>R6RS records seemed to be very sophisticated, in a good way IMO, just with some key flaws, and ostensibly too much complexity, which AFAIK was one of the reasons some people disliked R6RS. it's pretty sad. I hope SRFI-99 will make everyone happy One Day.
<davexunit>apparently racket has a nice 'struct' form that does what I want.
<davexunit>I guess I'll just write a syntax-case macro over define-record-type
<civodul>davexunit: what you want is unhygienic! :-)
<civodul>though i recall samth saying that in this case, it's acceptable
<davexunit>why is it unhygienic?
<davexunit>it would just be a syntax-case macro, I think...
<davexunit>please educate me :)
<civodul>because in your example you will generate 'foo-bar' and 'foo-baz'
<civodul>but these identifiers don't appear in the source
<davexunit>I guess I should note that define-record-type currently does some magic like this where it defines a GOOPS class
<davexunit>or rather, *something* defines a GOOPS class in response to creating a new record type
<civodul>yes, something, not the macro itself
<civodul>the magic is elsewhere :-)
<davexunit>I don't like that magic, so I guess I shouldn't like the magic I was proposing, either.
<davexunit>saves typing, but causes confusion?
<civodul>as i said, opinions vary
<civodul>samth is one of the syntactic hygiene "popes"
<civodul>yet he thinks this particular use case is okay
<civodul>i think wingo does the same in some places
<davexunit>the top-level is a special place. :)
<wingo>you can generate identifiers if they depend on some other identifier
<wingo>that's generally fine :)
*wingo currently hacking gdb/guile things
<davexunit>wingo: I was thinking of something like
<civodul>wingo: nice that you wrote the frame filters BTW
<wingo>for me racket's struct form is fine because there is n id
<wingo>*an id
<wingo>civodul: not accepted yet :)
<wingo>but working on it
<wingo>and currently working on some solution to be able to unwind frames using guile
<taylanub>civodul: FWIW R6RS records also do that identifier-generation (if one doesn't provide the identifiers explicitly)
<adhoc>wow the configure for guile-2.0.11 is huge!