Permalink
Browse files

Fix emitting/observing attributes in the weak TTL examples. They stil…

…l don't work, however.
  • Loading branch information...
1 parent 6eae87c commit 02cbace86c93007760218a9ad6dbfe3a07f6eacc @rcaputo committed Sep 7, 2010
View
@@ -1,10 +1,11 @@
-[_] 51% Framework Requirements
+[_] 47% Framework Requirements
About
This document summarizes the best ideas from the patterns document.
It is also a master TODO list for Reflex.
It's in Vim Outliner Format.
Basically just an outline where tab indents denote levels.
The "[_] 0%" is ongoing progress, managed by Vim Outliner.
+ http://sites.google.com/site/vimoutlinerinfo/ ... version 0.3.4 or later required.
The docs/patterns.otl document tries to enumerate all available options.
Even ones that have been discarded.
Even ones we'd like to do but may never get around to.
@@ -151,7 +152,7 @@
[X] 100% Moose introspection allows objects to find their contents.
[X] 100% Class Inheritance Rules
[X] 100% Class inheritance rules are delegated to Moose.
- [_] 24% Messaging Requirements
+ [_] 28% Messaging Requirements
[_] 0% Object command interfaces must be methods.
[_] 0% Methods on the objects themselves may pass messages into themselves.
Synchronous method calls are translated into asynchronous messages.
@@ -185,7 +186,7 @@
[_] 50% Emitted messages are next handled by explicit and role-based observers.
[_] 0% Explicit observers.
[X] 100% Role-based observers.
- [_] 80% All forms of message handler (callback) must be supported.
+ [X] 100% All forms of message handler (callback) must be supported.
[X] 100% Anonymous Coderefs
Anonymous coderefs support closures.
Anonymous coderefs and closures may be used to implement faux continuation passing style.
@@ -195,9 +196,6 @@
$object->watch( watched => $object, event => "name", callback => \&coderef );
[X] Traits.
has member => ( traits => ['Reflex::Trait::Observed'] );
- [_] 0% Named Subroutine References
- Named message handlers are exportable as reusable interfaces.
- [_] TODO - What is this?
[X] 100% Object Methods
Is this not obvious?
[X] Simple.
@@ -211,6 +209,9 @@
Classes may be used as singletons.
[X] 100% Do we want to support this?
[X] 100% Promises or condvars.
+ Named Subroutine References
+ Named message handlers are exportable as reusable interfaces.
+ Not needed. Roles perform this task.
[_] 0% Messages must be associated with their triggers.
[_] 0% One message may trigger another, inner message.
[_] 0% The inner message must be associated with the outer message.
@@ -245,7 +246,7 @@
[_] 0% Receiver data is not visible to the sender.
[_] 0% Message-scoped resources should be stored in the message's continuation.
[_] 0% Message cancelation triggers associated resource cleanup.
- [_] 63% Common primitive classes must be provided.
+ [_] 72% Common primitive classes must be provided.
[_] 50% Callback Abstractions
[X] 100% Reflex::Callback
[X] 100% Reflex::Callback::CodeRef
@@ -296,19 +297,20 @@
Manage a collection of Reflex objects.
Removes objects from itself when they shut down.
Reflex servers can use this to manage client objects.
+ [X] 100% has_many syntactic sugar for Reflex::Collection.
[_] 50% Process Watchers
[_] 0% Reflex::Role::ProcReaper?
I can't find a good reason to write this role.
This seems highly dynamic.
Contributions are welcome.
[X] 100% Reflex::PID
- [_] 50% Containership Traits
- [_] 50% Reflex::Trait::EmitsOnChange
+ [X] 100% Containership Traits
+ [X] 100% Reflex::Trait::EmitsOnChange
[X] 100% Initial implementation, with explicit syntax.
- [_] 0% Make declarative syntax so we can avoid the icky explicit use of traits.
- [_] 50% Reflex::Trait::Observed
+ [X] 100% Make declarative syntax so we can avoid the icky explicit use of traits.
+ [X] 100% Reflex::Trait::Observed
[X] 100% Initial implementation, with explicit syntax.
- [_] 0% Make declarative syntax so we can avoid the icky explicit use of traits.
+ [X] 100% Make declarative syntax so we can avoid the icky explicit use of traits.
[X] 100% POE Interfaces
[X] 100% Wheel wrappers.
[X] 100% Reflex::POE::Wheel
@@ -412,6 +414,7 @@
[_] 0% Reified version of Reflex::Role::Proxy
[_] 0% Based on the example proxy.
[_] 0% Between-endpoint flow control?
+ [_] 0% Generic rate throttling?
[_] 0% Reflex::Process
[_] 0% Strawman implementation.
[_] 0% Determine API.
View
@@ -1,7 +1,7 @@
# $Id$
# Full adder integrated circuit. Not clocked.
-#
+#
# A --------+---a\
# | (XOR ab)--+-a\
# B -----+------b/ | (XOR cin)----- Sum
@@ -27,69 +27,21 @@
package Ttl::Adder;
use Moose;
extends 'Reflex::Base';
+
use Ttl::Xor;
use Ttl::And;
use Ttl::Or;
-has a => (
- isa => 'Bool',
- is => 'rw',
- traits => ['Reflex::Trait::EmitsOnChange'],
-);
-
-has b => (
- isa => 'Bool',
- is => 'rw',
- traits => ['Reflex::Trait::EmitsOnChange'],
-);
-
-has cin => (
- isa => 'Bool',
- is => 'rw',
- traits => ['Reflex::Trait::EmitsOnChange'],
-);
-
-has xor_ab => (
- isa => 'Ttl::Xor',
- is => 'rw',
- traits => ['Reflex::Trait::Observed'],
-);
-
-has xor_cin => (
- isa => 'Ttl::Xor',
- is => 'rw',
- traits => ['Reflex::Trait::Observed'],
-);
-
-has and_ab => (
- isa => 'Ttl::And',
- is => 'rw',
- traits => ['Reflex::Trait::Observed'],
-);
-
-has and_cin => (
- isa => 'Ttl::And',
- is => 'rw',
- traits => ['Reflex::Trait::Observed'],
-);
-
-has or_cout => (
- isa => 'Ttl::Or',
- is => 'rw',
- traits => ['Reflex::Trait::Observed'],
-);
-
-has sum => (
- isa => 'Bool',
- is => 'rw',
- traits => ['Reflex::Trait::EmitsOnChange'],
-);
-
-has cout => (
- isa => 'Bool',
- is => 'rw',
- traits => ['Reflex::Trait::EmitsOnChange'],
-);
+emits a => ( isa => 'Bool' );
+emits b => ( isa => 'Bool' );
+emits cin => ( isa => 'Bool' );
+observes xor_ab => ( isa => 'Ttl::Xor' );
+observes xor_cin => ( isa => 'Ttl::Xor' );
+observes and_ab => ( isa => 'Ttl::And' );
+observes and_cin => ( isa => 'Ttl::And' );
+observes or_cout => ( isa => 'Ttl::Or' );
+emits sum => ( isa => 'Bool' );
+emits cout => ( isa => 'Bool' );
sub on_my_a {
my ($self, $args) = @_;
View
@@ -13,6 +13,7 @@ extends 'Ttl::Bin';
sub on_my_change {
my $self = shift;
+ warn 999;
$self->out( ($self->a() && $self->b()) || 0 );
}
View
@@ -5,26 +5,11 @@
package Ttl::Bin;
use Moose;
extends 'Reflex::Base';
-use Reflex::Trait::EmitsOnChange;
-
-has a => (
- isa => 'Bool',
- is => 'rw',
- traits => ['Reflex::Trait::EmitsOnChange'],
- event => 'change',
-);
-has b => (
- isa => 'Bool',
- is => 'rw',
- traits => ['Reflex::Trait::EmitsOnChange'],
- event => 'change',
-);
+use Reflex::Trait::EmitsOnChange;
-has out => (
- isa => 'Bool',
- is => 'rw',
- traits => ['Reflex::Trait::EmitsOnChange'],
-);
+emits a => ( isa => 'Bool', event => 'change' );
+emits b => ( isa => 'Bool', event => 'change' );
+emits out => ( isa => 'Bool' );
1;
@@ -9,44 +9,16 @@ package Ttl::FlipFlop::D;
use Moose;
extends 'Reflex::Base';
use Ttl::TriNand;
-use Reflex::Trait::Observed;
+
use Reflex::Trait::EmitsOnChange;
+use Reflex::Trait::Observed;
-has clear => (
- isa => 'Bool',
- is => 'rw',
- traits => ['Reflex::Trait::EmitsOnChange'],
-);
-
-has clock => (
- isa => 'Bool',
- is => 'rw',
- traits => ['Reflex::Trait::EmitsOnChange'],
-);
-
-has d => (
- isa => 'Bool',
- is => 'rw',
- traits => ['Reflex::Trait::EmitsOnChange'],
-);
-
-has preset => (
- isa => 'Bool',
- is => 'rw',
- traits => ['Reflex::Trait::EmitsOnChange'],
-);
-
-has q => (
- isa => 'Bool',
- is => 'rw',
- traits => ['Reflex::Trait::EmitsOnChange'],
-);
-
-has not_q => (
- isa => 'Bool',
- is => 'rw',
- traits => ['Reflex::Trait::EmitsOnChange'],
-);
+emits clear => ( isa => 'Bool' );
+emits clock => ( isa => 'Bool' );
+emits d => ( isa => 'Bool' );
+emits preset => ( isa => 'Bool' );
+emits q => ( isa => 'Bool' );
+emits not_q => ( isa => 'Bool' );
sub BUILD {
my $self = shift;
@@ -128,41 +100,11 @@ sub on_tri6_out {
$self->tri5->c($args->{value});
}
-
-has tri1 => (
- isa => 'Ttl::TriNand',
- is => 'rw',
- traits => ['Reflex::Trait::Observed'],
-);
-
-has tri2 => (
- isa => 'Ttl::TriNand',
- is => 'rw',
- traits => ['Reflex::Trait::Observed'],
-);
-
-has tri3 => (
- isa => 'Ttl::TriNand',
- is => 'rw',
- traits => ['Reflex::Trait::Observed'],
-);
-
-has tri4 => (
- isa => 'Ttl::TriNand',
- is => 'rw',
- traits => ['Reflex::Trait::Observed'],
-);
-
-has tri5 => (
- isa => 'Ttl::TriNand',
- is => 'rw',
- traits => ['Reflex::Trait::Observed'],
-);
-
-has tri6 => (
- isa => 'Ttl::TriNand',
- is => 'rw',
- traits => ['Reflex::Trait::Observed'],
-);
+observes tri1 => ( isa => 'Ttl::TriNand' );
+observes tri2 => ( isa => 'Ttl::TriNand' );
+observes tri3 => ( isa => 'Ttl::TriNand' );
+observes tri4 => ( isa => 'Ttl::TriNand' );
+observes tri5 => ( isa => 'Ttl::TriNand' );
+observes tri6 => ( isa => 'Ttl::TriNand' );
1;
@@ -22,53 +22,37 @@ package Ttl::FlipFlop::JK;
use Moose;
extends 'Reflex::Base';
use Ttl::Latch::ClockedNandRS;
-use Reflex::Trait::Observed;
-use Reflex::Trait::EmitsOnChange;
-has nand_j => (
+observes nand_j => (
isa => 'Ttl::Nand',
- is => 'rw',
- traits => ['Reflex::Trait::Observed'],
handles => { j => 'a' },
);
-has nand_k => (
+observes nand_k => (
isa => 'Ttl::Nand',
- is => 'rw',
- traits => ['Reflex::Trait::Observed'],
handles => { k => 'b' },
);
-has trinand_preset => (
+observes trinand_preset => (
isa => 'Ttl::TriNand',
- is => 'rw',
- traits => ['Reflex::Trait::Observed'],
handles => { preset => 'a' },
);
-has trinand_clear => (
+observes trinand_clear => (
isa => 'Ttl::TriNand',
- is => 'rw',
- traits => ['Reflex::Trait::Observed'],
handles => { clear => 'c' },
);
-has q => (
+emits q => (
isa => 'Bool',
- is => 'rw',
- traits => ['Reflex::Trait::EmitsOnChange'],
);
-has not_q => (
+emits not_q => (
isa => 'Bool',
- is => 'rw',
- traits => ['Reflex::Trait::EmitsOnChange'],
);
-has clock => (
+emits clock => (
isa => 'Bool',
- is => 'rw',
- traits => ['Reflex::Trait::EmitsOnChange'],
);
sub BUILD {
Oops, something went wrong.

0 comments on commit 02cbace

Please sign in to comment.