Git Product home page Git Product logo

Comments (7)

djdeath avatar djdeath commented on August 26, 2024

Ideally we could go as far as parsing json inputs that can then be fed to the ports of the graph.

from fbp.

alfa256 avatar alfa256 commented on August 26, 2024

When passing '\n' or other escaped characters they are treated as literals , this can be observed when using file writing components.
An "universal" data types proposal (instead of just using javascript types) could work accross platforms
Example:

'1' NUMBER -> IN SomeNode
'true' BOOL -> OPEN Gate
'["foo", "bar"]' STRING LIST -> IN OtherNode
'{"foo": 5, "baz": true }' OBJECT -> IN SomeThing

from fbp.

djdeath avatar djdeath commented on August 26, 2024

All of the previous are JavaScript expressions, couldn't just inject them directly into NoFlo using an eval() or something?

from fbp.

alfa256 avatar alfa256 commented on August 26, 2024

That can lead to abuse and bugs. But yes, JSON deserializing is what has to be done, with JSON.parse or some other safe method, eval() could mess with noflo. Although i'm not really happy in retrospective with the OBJECT type for IIPs, since it could be abused into messy graph definitions, but for testing it would be really nice.
Instead of just NUMBER, we could have FLOAT, INTEGER, DOUBLE, etc. For javascript they would all be just numbers, but for other implementations it can be different. The advantage is validating the IIP string.

from fbp.

djdeath avatar djdeath commented on August 26, 2024

There are easy ways to work around not using eval().
You could have something like :

el = JSON.parse("{ value: " + stringFromFbpFile + "}");

And then pass the el.value to the processes' ports.
I just find the NUMBER, LIST, OBJECT really difficult to work with.

How do you describe complex stuff like :

[true, [0, 1, 2, 3], "Plop"]
[{x: -1, y: 1}, {x: 1, y: -1}]
etc... ?

from fbp.

alfa256 avatar alfa256 commented on August 26, 2024

Wouldn't that be a smell? Configuring processes with contrived data structures doesn't seem smart to me at least.
It can work if you pass an object instead of a list of heterogeneous elements, otherwise it would look like noise in the FBP file, meaningless configuration string.

from fbp.

tlrobinson avatar tlrobinson commented on August 26, 2024

Heads up I've implemented this (basically just pulled in peg.js' JSON grammar) in #58.

from fbp.

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.