Giter Club home page Giter Club logo

Comments (5)

JensRavens avatar JensRavens commented on July 24, 2024

Can you give me an example how you're using this function? I'm not sure what's the use case actually.

from interstellar.

elm4ward avatar elm4ward commented on July 24, 2024

sure.
e.g.: when there is a signal containing a tuple, it provides me a possibility to update the value while
having access to the previous value.

var tupleSignal: Signal<(String, String)> = Signal("a", "b")

func updateFirst(string: String){
    tupleSignal.update {
      (string, $0!.1)
    }
}

from interstellar.

JensRavens avatar JensRavens commented on July 24, 2024

Wouldn't it be easier to just merge two signals in that case?

let a = Signal("a")
let b = Signal("b")
let tupleSignal = a.merge(b)

a.update("some new value") // tupleSignal now contains ("some new value", "b")

from interstellar.

elm4ward avatar elm4ward commented on July 24, 2024

in case I need to be able to observe both on their own? sure.
but this way it is possible to save those extra signals.
so there is only 1 instead of 3.
e.g. I am using it for sort and filter of data sources, where I can easily forget about the individual signals.
no worries if you don't see the use case. I can easily live on w/ an extension.
:-)

from interstellar.

JensRavens avatar JensRavens commented on July 24, 2024

The problem with your implementation is, that it will crash if one of the values becomes an error.

Handling tuples/merging signals is still not completely thought through, so I'm open to suggestions (see #16).

from interstellar.

Related Issues (20)

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.