[bolts] bolts.functioneditor - module for building function mixins?

aliak something at something.com
Tue Apr 7 11:50:10 UTC 2020


On Monday, 6 April 2020 at 20:52:56 UTC, Jean-Louis Leroy wrote:
> Hi Ali (and anyone interested).
>
> While implementing support for function attributes and 
> parameter storage classes in 'openmethods', then working on my 
> new 'ducktyping' library (golang-style interfaces), I came up 
> with a module that helps with creating function mixins derived 
> from an existing function. Since it is used in two distinct 
> projects, I want to put it in a library of its own.
>
> It seems to me that this is the sort of things that bolts is 
> all about. What do you think of taking it in?
>
> You can see some code here:
> https://github.com/jll63/openmethods.d/blob/using-function-editor/source/openmethods_functioneditor.d
> I suggest you take a look at the unit test at the bottom. Real 
> usage here: 
> https://github.com/jll63/openmethods.d/blob/using-function-editor/source/openmethods.d, search for occurrences of Editor.

Hey! At first look it does look like something bolts-y so I'm 
very open to discussing the usecases/problems to figure it out. 
And it initially looks like very cool stuff!

Am I correct in assuming that FunctionEditor is a way to 
"stringify" various attributes of a function, in order to create 
string versions of new functions, in order to mixin new functions?

Where being able to mock interfaces is one usecase?

What other usecases would there be?

I looked at the real usage you have, but I don't think I 
understood the dispatcher and discriminator

And, one last question:

If string interpolation was around would the interface you've 
designed be the same?

I opened an issue in github as well: 
https://github.com/aliak00/bolts/issues/9 just incase it makes 
more sense to discuss it there.

Cheers!


More information about the Digitalmars-d mailing list