bloom-lang / bud

Prototype Bud runtime (Bloom Under Development)
http://bloom-lang.net
Other
854 stars 60 forks source link

forbid <= outside of a bloom block? #246

Closed jhellerstein closed 11 years ago

jhellerstein commented 12 years ago

It seems semantically odd to allow <= to be used "between" or "before" ticks -- under what concept of "now" is that accumulation happening?

This relates to interfaces like sync_do and bootstrap blocks.

neilconway commented 12 years ago

<= in that context is essentially be used like set-wise <<. I agree it makes me a bit uneasy, although it isn't clear to me that disallowing it would be the right fix.

jhellerstein commented 12 years ago

Actually, it seems reasonable to interpret BudCollection#<< as the itemwise version of <+, or forbid it altogether.

neilconway commented 12 years ago

Meh, I suppose -- invoking logical operators outside of logic-land seems basically bogus to me; whether you interpret << as happening at "now" or "next" seems like 6 of one and a half-dozen of the other, IMHO. Interacting with Bloom collections from Ruby code (e.g., sync_do or bootstrap) is certainly useful, though.

jhellerstein commented 12 years ago

I hear what you say about logical operators "outside of logic land" -- i.e. between ticks. I feel that <+ is well defined between ticks, whereas the other ops are not. Similarly the only reasonable definition of bc << i is bc <+ [i] -- it installs a logical definition into the program beginning at the next tick (much like sending a message, but without non-determinism in time of receipt).

neilconway commented 12 years ago

Yeah, I can buy that. One concern is that this definition of << ("install a new fact @next") is not consistent with the normal meaning of << in Ruby ("append to an array, implicitly now").

sriram-srinivasan commented 12 years ago

The interpretation of <= has changed in the new runtime: it is now "add to delta", not "merge directly into storage". This is exactly the interpretation within a bloom block as well, under semi-naive evaluation.

Additionally, since all elements in delta are processed in the next iteration (if it is already inside a tick, or in the next tick), <= has the same interpretation and effect as <+ outside a tick: "add to a list of tuples to be processed, and process them at the next tick). '<+' moves stuff from pending to delta, in preparation for processing in the upcoming iteration. This is why we can use <= and <+ interchangeably in sync_do blocks.

<< should be removed, or confined only to bootstrap blocks.

neilconway commented 11 years ago

Per #289, this should be resolved.