!xiMNLXQQvmUKVgTwCc:matrix.org

VL-Language

28 Members
language design for VL3 Servers

Load older messages


SenderMessageTime
14 Jul 2020
@Hayden_A:matrix.orgHayden_AThis principle is used not only by us. But is a design pattern that is used in some csharp libs as well. Like reactive. Those operators all return an iobservable. But often enough delegates are there to fill out the details by the user08:13:45
@Hayden_A:matrix.orgHayden_AAlso our resource provider nodes are done that way. It's quite interesting how many classes you can get rid of if you have a very generic interface implementation via delegates 08:14:00
@Hayden_A:matrix.orgHayden_AAlso our resource provider nodes are done that way. It's quite interesting how many classes you can get rid of if you have a very generic interface implementation via delegates 08:14:11
@Hayden_A:matrix.orgHayden_AOn the road currently. But I can show you some csharp code later that gets away with that concept. 08:14:30
@Hayden_A:matrix.orgHayden_Ain our library we have something called Provider<T> (and in order to confuse everybody in C# we still call them IResourceProvider<T>)08:15:08
@Hayden_A:matrix.orgHayden_Aimage.png
Download image.png
08:15:19
@Hayden_A:matrix.orgHayden_Aand we hav IResouceHandles08:15:27
@Hayden_A:matrix.orgHayden_Aimage.png
Download image.png
08:15:51
@Hayden_A:matrix.orgHayden_Aunder category Resources we have quite a bunch of operator that work on these guys and all return new providers that then allow to fecth handles from them, which can be disposed when you don't need them any longer and also give you the actual resource... We could have written classes for each different operator. One for the provider, one for the handle. Giving us full control over the implmentation. 08:15:58
@Hayden_A:matrix.orgHayden_AWe didn't. The logic of the implementation would have spreaded over constructors and methods and dispose calls of different classes just to implement one operator. 08:16:18
@Hayden_A:matrix.orgHayden_ASo here is what we did:08:16:46
@Hayden_A:matrix.orgHayden_Aimage.png
Download image.png
08:16:53
@Hayden_A:matrix.orgHayden_Athis is one "stupid" implementation of provider, just calling the delegate "producer" whenever a handle gets requested.08:17:07
@Hayden_A:matrix.orgHayden_A and for the handle:08:17:18
@Hayden_A:matrix.orgHayden_Aimage.png
Download image.png
08:17:25
@Hayden_A:matrix.orgHayden_Aimage.png
Download image.png
08:17:42
@Hayden_A:matrix.orgHayden_Aallowing to write very compact code:08:18:09
@Hayden_A:matrix.orgHayden_Aalmost every operator is written in that style. all the logic is in one place. (you don't need to introduce classes, feed some information to the constructor only to be able to get a hand on it later in another method.) instead only local variables are used that then somehow get captured in a closure (like the resource variable here) and later on in the dispose logic of the handle you can still access it. 08:18:23
@Hayden_A:matrix.orgHayden_Aand this is the RenderingNode implementing an interface "Layer" in skia. Used in pretty much every rendering node.08:18:32
@Hayden_A:matrix.orgHayden_Aand this is the RenderingNode implementing an interface "Layer" in skia. Used in pretty much every rendering node.08:18:43
@Hayden_A:matrix.orgHayden_Aimage.png
Download image.png
08:19:00
@Hayden_A:matrix.orgHayden_Athe patches themselves don't have to implement the interface anymore. The don't have to store a Rectangle in a field in order to read it back when the Render call comes. The link into the region does that magic for you. It manages to capture a value outside the implementation and make use of it inside of it. The region implements the interface, implemts those interface operations (in this case "Render"), but on the fly, within the context of the surrounding patch, making use of the information that is available on update of the surrounding patch. 08:19:09
@Hayden_A:matrix.orgHayden_A The above is from the vvvv chat room, but is maybe more appropriate here. Thanks very much [gregsn](https://matrix.to/#/@gregsn:matrix.org) ! 08:20:07
27 Aug 2020
@sebl:matrix.orgsebli have a new one ;) https://github.com/vvvv/VL-Language/issues/2715:33:10
@sebl:matrix.orgseblmaybe the usecase is a bit too complicated/specific15:37:31
@gregsn:matrix.orggregsnthe example is a bit "disturbing" 😀15:45:18
@sebl:matrix.orgseblHarr15:46:07
@gregsn:matrix.orggregsnat least from the perspective of a "statically typed language" that allows to "program" something (given the right static dependencies on node providing "factories"; dlls, effects, project files, whatever, static though), that after compilation just works. as it made sense at compile-time.15:48:07
@gregsn:matrix.orggregsnin your example i would get a red pin + red link when the content of that file changes.15:48:48
@sebl:matrix.orgseblyes, ok15:48:56

Show newer messages


Back to Room List