--
You received this message because you are subscribed to the Google Groups "object-composition" group.
To unsubscribe from this group and stop receiving emails from it, send an email to object-composit...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/object-composition/CAF1P%2BymJ-mTPexmcgU_zXuFj-BiL20YeQtjvhqDNzdQez_rm8g%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/object-composition/CAJA9FQ_xVDc9C58g7oYXn%2Bbo8sVw1TFBApY12X40OFSHKoCnXg%40mail.gmail.com.
Hi Rune,
I was thinking of something like this:
https://github.com/jcoplien/trygve/blob/master/examples/july_money_transfer_2.k#L307
In that example, you can't change the balance of the source account or mutate it in any way, but the object can still be mutated when it's passed to the TransferMoneyContext because it's a role there and not a stageprop.
So I was wondering if in F# there would be some way to "lock" an
object when it's in a particular scope, but thinking more about it
and how it works in trygve I'm realizing that's probably unlikely.
But at least in F#, it looks like object properties are immutable
by default unless you mark them as mutable, so that still reduces
the overall chance of unintended side effects.
To view this discussion on the web visit https://groups.google.com/d/msgid/object-composition/CAF1P%2BykCaRXtBqQud8vhVAqL2xjcxrNMRQq4UJGNOac2_v-8RA%40mail.gmail.com.
Also, @Cope, if you're still following this group...
When I was looking up the trygve examples, I noticed that the
listing on the website is missing a lot of the latest examples:
http://fulloo.info/Examples/TrygveExamples/
Maybe it would make more sense to point the link directly to
GitHub so it's always up-to-date?
https://github.com/jcoplien/trygve/tree/master/examples
To view this discussion on the web visit https://groups.google.com/d/msgid/object-composition/eb87d97d-96b7-dce5-7bd2-2948d4dd9721%40gmail.com.
It’s the other way around using my F# stuff. You’d need to explicitly specify that you want to mutate the player (and the player needs to be mutable)MvhRune
Den 15. sep. 2021 kl. 05.17 skrev Matthew Browne <mbro...@gmail.com>:
Hi Rune,
That makes sense.To take your address example, let's suppose we have a ChangeAddress context and also a GenerateAddressReport context, and a user's address should be changed in the ChangeAddress context of course, but never in the GenerateAddressReport. How would you enforce that? Or is it necessary to enforce that?
I'm not sure I ever fully understood the 'stage prop' concept—after all, the context author can simply avoid mutating properties that shouldn't be mutated in that context. OTOH, in a custom language like trygve, the stage prop could also be designed to prevent mutation even outside the context if it's within the scope of a call that originated from inside the stage prop (I can't remember off the top of my head if trygve already does that)...but I doubt that would be possible in existing languages.
Anyway, this is a fairly minor consideration in the context of your F# implementation, which is totally usable as-is.
To view this discussion on the web visit https://groups.google.com/d/msgid/object-composition/CAF1P%2BykRE-MZXTjgJ-SEBHF5B-s-9Fok5vpaYq_uZuXxc-jfYA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/object-composition/CAJA9FQ-rKGRmJPqA7S_2TnYUay1QZn7fKMxTPfTsX3poYivJ7Q%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/object-composition/CAF1P%2By%3DzFbZK%2BBfdPQ9Z%3DcGDC4yH3VD1MCq2g2Q2Q%2BnK00Ftxg%40mail.gmail.com.