--
You received this message because you are subscribed to the Google Groups "object-composition" group.
To view this discussion on the web visit https://groups.google.com/d/msg/object-composition/-/EwngtHqFHl4J.
To post to this group, send email to object-co...@googlegroups.com.
To unsubscribe from this group, send email to object-composit...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/object-composition?hl=en.
Therese a fem issues* you are wrapping the role players* roles aren't internal to the context
Currently to me it seems wrapping is a better fit for JS since it avoids problems
Is it possible without adding any extra wrapping? It's really hard to see how it would be possible.
In your example object is unable to play multiple roles. (If you mean this example: http://jsfiddle.net/K543c/17/)
On Monday, December 24, 2012 10:03:57 AM UTC+2, Rune wrote:Den 23/12/2012 kl. 22.53 skrev Egon Elbre <egon...@gmail.com>:
>
> Is it possible without adding any extra wrapping? It's really hard to see how it would be possible
Yes it certainly is. JS is one of the languages that gets closest to
DCI there two problem, one of which has a simple solution.
The two problems are cleaning up do to lack of finalizers you need to
do the cleaning up manually. The other is when instance and role
methods clash see another thread on this. I've posted a JS solution a
month or so ago.
--
You received this message because you are subscribed to the Google Groups "object-composition" group.
To view this discussion on the web visit https://groups.google.com/d/msg/object-composition/-/WzhW-bJQ6NoJ.
Den 24/12/2012 kl. 09.13 skrev Egon Elbre <egon...@gmail.com>:In your example object is unable to play multiple roles. (If you mean this example: http://jsfiddle.net/K543c/17/)That would be a limitation I was unaware of when I hacked it together aside from not handling name clashes (except for very trivial ones) why do you think it doesn't support playing multiple roles?
I don't even mean just javascript - in any language. It either must have a wrapping or the wrapping has been hidden or it doesn't support all of DCI.
Hence one object multiple roles - do an assignment and there's no way to know which role that variable is meant to be playing
On Dec 24, 2012, at 12:15 , Egon Elbre wrote:I don't even mean just javascript - in any language. It either must have a wrapping or the wrapping has been hidden or it doesn't support all of DCI.Please go do a good more reading about DCI. I think you need a firmer grounding in its principles to understand even what we're trying to do. Retaining the object notion of identity (an object has state, behavior, and identity) is crucial to true DCI. When Trygve and I tried this with wrappers we ran into horrific bugs. ObejctTeams has the same problem.
Once you have understood the basics, then have a look at the code examples on fulloo.info. They avoid wrapping. Dependency injection is one technique; specific languages and environments use a variety of other tricks to make this work without descending to wrapping.
--
You received this message because you are subscribed to the Google Groups "object-composition" group.
To view this discussion on the web visit https://groups.google.com/d/msg/object-composition/-/5tnsntN1zDgJ.
Den 25/12/2012 kl. 18.49 skrev Egon Elbre <egon...@gmail.com>:On Tuesday, December 25, 2012 5:32:33 PM UTC+2, Rune wrote:Den 25/12/2012 kl. 11.03 skrev Egon Elbre <egon...@gmail.com>:
> Javascript-DCI by Rune: doesn't handle multiple Roles
Not true it easily handles multiple roles even when played by the same objectThere you go: http://jsfiddle.net/KxJ9B/That's not due to multiple roles but due to a name clash which if no news. Multiple roles is not an issue
Or maybe simpler: replace every method call of RoleName.method(args)with Dispatch(RolePlayer, Role, "method", args).In Java it's possible to do the two latter ones.
I agree that the mechanism shouldn't matter.
The test case is Dijkstra's Algorithm, posted in several language variants on fulloo.info. Egon, please argue in Ruby code.
(mostly I'm language unbiased, I just pick whatever feels easiest to write and least ambiguous at some point)
The proof should be in the pudding, so I will see what I can come up with. (But I won't guarantee success)
Hi Egon,
The Scala macro approach doesn't wrap. I don't understand what you mean with "deep copy on the Role"…?
Can you help me locate the github explanations that led you to these impressions, so that I can make those more clear?
It seemed to me that when you do a deep-clone on the Role it will act as the Role.
Please try the Manhattan Dijkstra algorithm to see if it works.
On Wednesday, December 26, 2012 6:11:08 PM UTC+2, Marc Grue wrote:Can you help me locate the github explanations that led you to these impressions, so that I can make those more clear?Mainly the explanation in "Compound objects and re-binding" and the Example from github page.Also the core in the core source it saysGenerates the following code for the Role Player 'Account with Source'
new $AnonClass(RolePlayer](MoneyTransfer.this.acc1).obj)Which to me seems like creating a new object based on the created class and using that as the Role.
Hi Egon,I don't understand where deep copying relates to DCI. If you see a potential problem I would be happy to test it against the macro - in that case some pseudo testing code could serve as a start...
On 26/12/2012, at 18.52, Egon Elbre <egon...@gmail.com> wrote:
On Wednesday, December 26, 2012 6:11:08 PM UTC+2, Marc Grue wrote:Can you help me locate the github explanations that led you to these impressions, so that I can make those more clear?Mainly the explanation in "Compound objects and re-binding" and the Example from github page.Also the core in the core source it saysGenerates the following code for the Role Player 'Account with Source'
new $AnonClass(RolePlayer)(MoneyTransfer.this.acc1).obj)
Which to me seems like creating a new object based on the created class and using that as the Role.
Thanks for the pointers - I'll have a look to see if I can clarify.Having only limited knowledge of the inner mechanics and concepts of Scala, my understanding so far is that the role binding mechanism of my macro is not creating a new object at runtime. A synthetic anonymous class ($anon) is created at compile time that extends the instance class and Role trait. At runtime the instance object will then find itself augmented with the role trait mixed in (magic!).Later I can rebind another Role to the same object by removing the old mixin and add another one - all at compile time. We can bind the roles as though it would happen at runtime, but the "preparation" happens at compile time. In a way we can have and eat the cake at the same time!I'm on thin ice on this, so before we have a Scala expert on board, I would take my explanations with a big grain of salt :)
that shows that it's not the same object. I don't know when the role object is created and how its calls get delegated to the obj, but in my opinion it really doesn't matter, since most of the time it's nicely hidden.
since most of the time it's nicely hidden.
Having only limited knowledge of the inner mechanics and concepts of Scala, my understanding so far is that the role binding mechanism of my macro is not creating a new object at runtime. A synthetic anonymous class ($anon) is created at compile time that extends the instance class and Role trait. At runtime the instance object will then find itself augmented with the role trait mixed in (magic!).
I'm on thin ice on this, so before we have a Scala expert on board, I would take my explanations with a big grain of salt :)
Implemented an DCI lib with javascript:I've tested it only in chrome.
I think the source transformation is a very promising approach. It could even be changed to allow for a Marvin-like syntax with a "role" keyword, etc.
As to the compilation step, compilation could actually be done in the browser prior to running the code, which might be useful for development purposes, although my personal preference would be to use something like LiveReload, which runs compilers for you as soon as you save the file, then reloads the page for you (and there are ways to achieve the same thing with node.js for free without requiring the purchase of LiveReload).
If it were implemented for both Javascript and CoffeeScript I think it would definitely further the use of DCI in the Javascript community (both client-side and server-side).
I could post an example of how the syntax might work if people are interested. I'm thinking that it would use the new ECMAScript 6 syntax for classes, and be quite similar to Marvin for contexts, roles, and interactions. I don't know much about the implementation details of source transformation so perhaps this is too ambitious, but Egon's example is encouraging.
Since the function works in Javascript you should be able to call it from CoffeeScript.
--
You received this message because you are subscribed to a topic in the Google Groups "object-composition" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/object-composition/5YJ6duRtdTQ/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to object-composit...@googlegroups.com.
To post to this group, send email to object-co...@googlegroups.com.
Visit this group at http://groups.google.com/group/object-composition?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.