On Saturday, 30 September 2023 at 12:40:29 UTC, Guillaume Piolat wrote:
>When is it useful?
You can use it to troll Jonathan Blow.
September 30, 2023 Re: implicit-context v0.0.1 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Guillaume Piolat | On Saturday, 30 September 2023 at 12:40:29 UTC, Guillaume Piolat wrote: >When is it useful? You can use it to troll Jonathan Blow. |
October 02, 2023 Re: implicit-context v0.0.1 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Guillaume Piolat | On Thursday, 28 September 2023 at 23:28:02 UTC, Guillaume Piolat wrote: >
I wonder if |
October 03, 2023 Re: implicit-context v0.0.1 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Max Samukha | On Saturday, 30 September 2023 at 15:02:16 UTC, Max Samukha wrote: > >When is it useful? You can use it to troll Jonathan Blow. OT: Apart from being marketed more like a game (streaming videos, and similarly "finished" at launch?) I was striked that Jai has already many... perlisms in the syntax. As for the other features that makes me pause, it's SoA. Is this composable? |
October 03, 2023 Re: implicit-context v0.0.1 | ||||
---|---|---|---|---|
| ||||
Posted in reply to MrSmith33 | On Monday, 2 October 2023 at 19:04:19 UTC, MrSmith33 wrote: >On Thursday, 28 September 2023 at 23:28:02 UTC, Guillaume Piolat wrote: >
I wonder if Do you mean with:
Because at a point there was such a RAII context wrapper. I didn't realize, |
October 05, 2023 Re: implicit-context v0.0.1 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Imperatorn | On Friday, 29 September 2023 at 08:33:56 UTC, Imperatorn wrote: >On Thursday, 28 September 2023 at 23:28:02 UTC, Guillaume Piolat wrote: >Hi, Ever had a bit of feature-envy about Odin's "context" feature [1]? It is something used to pass "contextual" parameters, like a logger, an allocator, to callees. It is akin to Scala's "implicit parameters", or Jai contexts [2]. [...] Interesting, what are the benefits of using this instead of global variables? Context is dynamically generated/destroyed. I developed this Idea in 2009 with c#. We named this "functional context" (15 years ago)... I found out later something similar with AOP (Aspects Oriented Programming) when working with Spring in java Lets see an example
The "withTransaction" function, iternally, asks the context if there is an opened transaction.
This use case of "implicit-context" works naturally in a "per thread context". Stackability is nice: (this example is not so real, but a "how to" example):
It shoud be more natural this way ...
... but remember than we need to manage "exceptions" dependant behaviours implicitly: with( is not an option for AOP. As you can see, this is not an "Object oriented dependency injection"... Each "withX" internally interacts with the context to find or create the resource and, additionally, performs some functional extra proccessing (before, after and exception). i.e.: withHttpResponse:
As a ramarkable benefit: it is really simple to wrap with mockups when testing Problems?
It was only a possible use of "implicit context" :-) Best regards |
October 06, 2023 Re: implicit-context v0.0.1 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Antonio | On Thursday, 5 October 2023 at 22:38:35 UTC, Antonio wrote: >On Friday, 29 September 2023 at 08:33:56 UTC, Imperatorn wrote: >[...] Context is dynamically generated/destroyed. I developed this Idea in 2009 with c#. We named this "functional context" (15 years ago)... I found out later something similar with AOP (Aspects Oriented Programming) when working with Spring in java [...] Oh, I remember now. Long time since I heard anyone speak about AOP. But I think it was a valid idea. |
October 10, 2023 Re: implicit-context v0.0.1 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Guillaume Piolat | On Friday, 29 September 2023 at 11:00:05 UTC, Guillaume Piolat wrote: >On Friday, 29 September 2023 at 08:33:56 UTC, Imperatorn wrote: >[...] Thinking about this, it's more vs TLS variable. __gshared would require synchronization. [...] Do you have an example of how this would be used in practice with allocators? |