Code Monkey home page Code Monkey logo

Comments (3)

cryptokoans avatar cryptokoans commented on June 2, 2024

I'm having a hard time finding where in the code it enforces this display-once semantics. For example,

val myString = string("mystring,"")
val myString2 = myString
val both = myString &> mystring2
render(both,..)

This will only will render the myString component once which means that (rightfully so) it treats myString2 as identical to myString and therefore seems to ignore one of them?

In other words, it seems that myString &> myString2 is equivalent to myString &> myString and that therefore the &> operation is idempotent?

from owlet.

jcouyang avatar jcouyang commented on June 2, 2024

Yes it is intended.

An Owlet is actually a bifunctor, but you can only map on the right value(signal), left (node) map is always identity, so the actual value of node never change no matter how many times you map it.

The other way of thinking is imagine using spreadsheet

You create an input in a1 cell
and than create an a2, it's value is fx=a1

In the spreadsheet you only got one input box a1, a2 is output fx cell not input

Not sure if it make sense to you?

from owlet.

cryptokoans avatar cryptokoans commented on June 2, 2024

Yes, it makes sense now that you mention that Owlet (at least how it is currently implemented) is a bifunctor. However, let's think about this for a bit:

output(a) &> output(a) behave as expected in the sense that the Owlet a is displayed twice. My argument is that there should be a similar notion of, for example, input(a) &> input(a) where the ability to change value associated with Owlet a is available at two places on the page. Of course to prevent errors/race-conditions and such, the user should only be able to ever actually interact with one of the inputs at a time (e.g. if the user interacts with the first one, then the 2nd one is perhaps "disabled" or maybe (temporarily) switches its rendering to something more akin to output(a) until the user has finished interacting with the input.

In other words if we could come up with a clever way to add a function input(..) then we can still preserve the semantics of the spreadsheet model like you are envisioning while opening up the possibility of the value being "editable" in more than one location (for example, across a network boundary!?). The library would hide the complexities around the race conditions associated with the user editing the value in more than one place (e.g. it would ensure that only the most recent edit "wins" in the case of a synchronous local computation, or uses some other consensus mechanism in the case of an asynchronous one across a network boundary or something -- details on this front could actually be pluggable I think).

I hope the intuition as to why this would be useful is beginning to come across? If not, I'll try to come up with a more concrete example.

Bottom line: spreadsheet programming where all the components are on the same page is neat, but spreadsheet programming where (some of) the components are spread out across the network/internet (if possible) is "really neat" to think about :-)

from owlet.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.