[rdnzl-devel] A question about CAST

Edi Weitz edi at agharta.de
Thu Apr 26 08:31:29 UTC 2007


On Wed, 25 Apr 2007 09:33:39 +0200, "Iver Odin Kvello" <iok at selvaag.no> wrote:

> We've recently started using RDNZL for integration between an
> internal application written in ACL 7.0 and a CAD system using a
> .Net-based extension-layer in the latter; using .Net Remoting for
> communicating between the two systems. We've found that RDNZL works
> robustly, reliably and is very easy to use. Thank you very much for
> creating it.

Thanks, that's good to hear.

> I have a question with regards to the action of the CAST operator:
> Currently, when CAST'ing from one .Net class to another, the type of
> the container is destructively updated; and there doesn't seem to be
> any way of copying a container so that a reference to the same
> object but with another type can be created.  That is, I'd like to
> do something like
>    (cast foo "SomeType"))
>    (setq bar (copy-container foo))
>    (cast bar "SomeOtherType"))
> without the last operating also setting the type of FOO to
> SomeOtherType [1]
> Is there some idiom that would work like this that I've missed?

I first have to admit that I myself am pretty busy with other stuff at
the moment and that I haven't used RDNZL in earnest for quite some
time, so bear with me if I'm talking nonsense... :)

The answer IIRC is that what you want is currently not supported.

> If not, I guess the functionality would have to be added at the C++
> level, which I haven't really looked at yet. Any pointers would be
> appreciated.

Yes, you'd have to do that at in the C++ code, i.e. create a "copy"
operation in the DotNetContainer class which copies an existing
container and returns (a pointer to) the copy.  And export that
operation so that you can use it from Lisp.  And then make it
available to Lisp via the FFI.  I /think/ that shouldn't be too hard
and shouldn't result in any GC problems.

Of course, if you do that it'd be nice if you could send your
modifications back to the list so I can include it in a future


> The actual situation that came up was this: We have a remote object
> - actually a transparent proxy - of an interface-type WALL, and we
> need to get a reference to its lease. However, to to this we must
> cast the object to MarshalByRefObject, and if we use CAST to get
> this, it is impossible to CAST back to the original interface type.

I'm probably too dense at the moment, but /why/ can't you just cast


More information about the rdnzl-devel mailing list