Mart van de Wege
7/24/2015 6:12:00 PM
His Kennyness <kentilton@gmail.com> writes:
> On Saturday, July 18, 2015 at 2:14:07 PM UTC-4, Mart van de Wege wrote:
>> >> I'm trying to build a constructor function that calls make-instance, but
>> >> the number of arguments to pass to make-instance is unknown and depends
>> >> on the number of parameters passed to the original function.
>> >>
>> >> I can do this with a macro easily, but is it possible to do it with a
>> >> function?
>
> Don't do it at all. Sonya Keene was wrong. CLOS is very powerful and
> you lose all that power when you hide make-instance behind a maker
> function.
>
Well, all very nice, but I have good reasons to want to wrap
make-instance. My application domain has a shortcut to specify a number
of slot values, and the expected use case is to be able to use the short
notation to instantiate an object.
The other way around is to add a keyword argument to initialize-instance
:after, and handle the parsing of the short code and generating the
other initargs from there, but then I'm writing a constructor function
anyway.
In other words: please refrain from assuming you know the application
domain.
Mart
--
"We will need a longer wall when the revolution comes."
--- AJS, quoting an uncertain source.