[CM] Expose object_type_name/type-name
chohag at jtan.com
chohag at jtan.com
Tue Mar 31 16:06:19 PDT 2026
bil at ccrma.Stanford.EDU writes:
> Thanks for the suggestion. I'm thinking maybe type->string
> would be more schemish, or is that bikeshedding? Also it
> can't return the built-in string directly because then someone
> could inadvertently clobber s7's error messages.
> And there are two ways to handle port type names,
> type-name would probably replace class-name, etc.
> I just spilled a huge cup of coffee all over my
> keyboard, desk, myself, and worst of all the mouse pad.
> This may take awhile.
>
A bit of bike-shedding is in order, I've put zero thought into this
interface: I only noticed that type-of didn't do what I thought it
did when trying to generate errors like s7_wrong_type_arg_error
etc. and simply duplicated that interface after I tracked down where
the nouns were coming from.
Speaking of bike-shedding why does type-of return a symbol that
names a predicate and not the predicate itself given that we can
extract the name from the predicate function? eg. (type-of 42)
returns 'integer? which I then have to evaluate to find the actual
(integer?) function and hope I'm looking in the correct let which
of course will work 99% of the time until it doesn't. The expression
(format #f "~A" integer?) will return "integer?" if I do need the
name in a string-like form.
Are the strings returned by type-name not immutable? In any case
if people go munging built-in strings that sounds like a "you broke
it, you get to keep both parts" type of problem.
The main thing I'd like to keep is that whatever they're called I
can bind type-name (and type-of) in an open let so that I can detect
and report on function arguments with an oops flavour.
On which note, enjoy your coffee.
Matthew
More information about the Cmdist
mailing list