You mean that if I have multiple std.in's non of them fire until the input is flushed by a CR, and then all of them fire? That does make sense alright.
But it still leaves me with another set of questions: how can we handle consistency/synchronisation in the general case? How would we go about building our own queue until flushed mechanisms with ANI code? Or do we not need to? If not, why not?
On Jul 25, 8:38 pm, Mark Henderson <markh...@gmail.com> wrote:No, I wasn't intending that to be the default behavior (I was instead
> Hmm. Is a CR required from the user before std.in sees the new a/b/
> op?
intending the injection into std.inBlah to be instantaneous) -- I
intend the behavior to be more like a direct link to the keyboard than
a shell-mediated prompt.
>
> On Jul 25, 9:48 pm, Daniel Kersten <dkers...@gmail.com> wrote:
>
>
>
> > Hi,
>
> > I'm trying to refamiliarize myself with ANI after some time away from it and
> > have come across a question.
>
> > In the realtime clock + calculator example, won't the clock part use stale
> > data while it is reading input? If not, why not?
>
> > Let me explain:
>
> > If you type 1 and + then a is assigned 1 and op is assigned '+'. b has not
> > yet been assigned (maybe I'm a slow typist). Now the next clock "tick" kicks
> > in and it prints something like "1 + 0 = 0" (a=1, op=+, b=0, r=0). This is,
> > obviously, incorrect. What we would really like is that the new values of a
> > and op are not seen until b and r are updated too (an atomic transaction, of
> > sorts).
>
> > Thanks.
> > --
> > Daniel Kersten.
> > Leveraging dynamic paradigms since the synergies of 1985.
That's my goof, then...
Maybe I wrote it before I established the terminology in my head, but constants and latches are almost opposites as far as the language goes, so that part definitely needs a rewrite. Then again, so does most of the tutorial, with all of the new features and syntax tweaks that have arrived as of late.
On Jul 26, 2010 12:51 AM, "Daniel Kersten" <dker...@gmail.com> wrote:
"constant latches" are mentioned in the tutorial.
On 26 July 2010 08:14, Adrian <ult...@gmail.com> wrote:
>
> On Jul 25, 11:59 pm, Daniel Kersten <...
On Jul 25, 7:48 pm, Daniel Kersten <dkers...@gmail.com> wrote:
> Hi,Hey Dan,
>
> I'm trying to refamiliarize myself with ANI after some time away from it and
> have come across a question.
>
> In the realtime clock + calculator example, won't the clock part use stale
> data while it is reading input? If not, why not?
>
> Let me explain:
>
> If you type 1 and + then a is assigned 1 and op is assigned '+'. b has not
> yet been assigned (maybe I'm a slow typist). Now the next clock "tick" kicks
> in and it prints something like "1 + 0 = 0" (a=1, op=+, b=0, r=0). This is,
> obviously, incorrect. What we would really like is that the new values of a
> and op are not seen until b and r are updated too (an atomic transaction, of
> sorts).
>
> Thanks.
Haven't talked in a while, have we? I guess we've both been busy with
life (don't worry though, anic's not going anywhere!).
Anyway, you are correct in noting that "stale" (non-atomic) reads are
possible with the implementation that's currently up; hence, the
output might be inconsistent at certain points of the input fetching
process. It's not meant to be a robust, clean, and fault-tolerant
program -- it's meant to be a bare-bones implementation in four lines
of code ;).
The above calculator object updates its internal resultBuffer only
upon full computation of a result, and hence its output (string
representation) is always going to be consistent. ANI/anic can't guess
which data the programmer intends to be atomic (and what not), since
in interactive, real-time applications, atomicity is a highly context-
dependent implementation decision. ANI does, however (I think) make it
easy to build systems that behave in whatever way the programmer
intends, which is the main purpose of a programming language in the
first place.
Hopefully this helps!
> --
> Daniel Kersten.
> Leveraging dynamic paradigms since the synergies of 1985.