excel-d icon indicating copy to clipboard operation
excel-d copied to clipboard

allow creating object with handle as Xenon does

Open Laeeth opened this issue 4 years ago • 4 comments

suppose you take market rates and create a calibrated curve. you might want to have several different calibrated curves in a spreadsheet, maybe using same market datas with different parameters.

you know the location of the calling cell. so the user-defined D function you call from Excel can create a new 'object' with a text handle associated with that cell. and to refer to that object you just pass the handle as a string in to another user-defined function.

it's not much work to do but would be useful at some point. speak to @John-Colvin or @9il if questions. also richard m.

Laeeth avatar Oct 21 '19 15:10 Laeeth

It basically boils down to subscribing a new RTD topic for each object by hashing the function & parameters used to create it, creating a unique identifying string handle for the object, storing the object somewhere you can look it up with that handle and returning the handle to the cell. You need to RTD topic to give you a way to delete the object (or at least your reference to it) when the contents of the creating cell changes.

There are some sticking points like async functions. You need to return something initially while the cell is calculating and then when the cell recalculates changes you need to hang onto the previous result until the new one is ready or you end up with sheets flashing up "# N/A" all over the place any time anything changes.

rmanthorpe avatar May 01 '20 13:05 rmanthorpe

Yes, I need this as well for exposing bloomberg subscriptions to excel. Simple request/response calls to bloomberg hit our quota, so we need to open subscriptions instead.

Lifecycle is a problem so xll-d needs to support this natively.

skoppe avatar Oct 29 '21 11:10 skoppe

We can do it already using mir.net and mir type system the same way we do it in Xenon. It fully @nogc and nocopy interaction with C#/C++/D that allows you to pass and forgot a reference to a data of any complexity. C# feels much better for Excel than any D wrapper we may have.

@skoppe Nick said it is important to have an OOP excel APIs. Can we propose @hatf0 to work on Mir->C# reflection layer? I would help him as well. We already solved a lot of related problems in mir.net such that memory management and exception handing. That would be a great benefit for Xenon as well.

9il avatar Oct 30 '21 02:10 9il

We can do it already using mir.net and mir type system the same way we do it in Xenon. It fully @nogc and nocopy interaction with C#/C++/D that allows you to pass and forgot a reference to a data of any complexity. C# feels much better for Excel than any D wrapper we may have.

I don't think this is enough for subscriptions. This is real-time-data I am talking about.

Nick said it is important to have an OOP excel APIs

I don't know what is meant by this. Perhaps good to discuss this in more detail in private.

Can we propose @hatf0 to work on Mir->C# reflection layer? I would help him as well.

As long as it supports Streams (aka async iterators).

skoppe avatar Oct 30 '21 18:10 skoppe