Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic assignment of indices #22

Open
jpaulm opened this issue Sep 20, 2014 · 5 comments
Open

Automatic assignment of indices #22

jpaulm opened this issue Sep 20, 2014 · 5 comments
Labels

Comments

@jpaulm
Copy link
Contributor

jpaulm commented Sep 20, 2014

In https://github.com/flowbased/flowbased.org/wiki/FBP-DSL , it says: "The javascript implementation of the parser assumes order of declaration as the index automatically, but this is not a characteristic of the DSL."

I assume this means that, if the parser knows that the port is an array port, and if the the port is somehow marked as an array, that the indices will be assigned automatically, unless explicitly overridden. How is the port marked as an array? I am guessing that you use empty square brackets, but, whatever you use, it should be spelled out explicitly.

Thanks in advance,

@alfa256
Copy link

alfa256 commented Sep 20, 2014

Let me explain, it works like this:

Foo OUT -> IN Bar
Foo OUT -> IN Zaz

Is the equivalent of:

Foo OUT[0] -> IN Bar
Foo OUT[1] -> IN Zaz

I do not know the reason for this, I just described what it does.

@oleksandr
Copy link
Member

Explicit specification of a port index is part of the PEG grammar (https://github.com/noflo/fbp/blob/master/grammar/fbp.peg). I think a required order of declaration is a bad idea. At least in the Go version of FBP DSL (https://github.com/oleksandr/fbp) the indices should be specified explicitly and the order does not matter.

@bergie
Copy link
Member

bergie commented Sep 20, 2014

@oleksandr I think the automatic assignment unless specified is an artifact of original NoFlo handling of ArrayPorts, and shouldn't be part of the spec.

Of course, the problem is that the FBP parser doesn't really know anything about the components, and so can't throw a parse error on non-indexed connection with ArrayPort. But well-behaved FBP runtimes probably should.

@jpaulm
Copy link
Contributor Author

jpaulm commented Sep 20, 2014

Alex, I agree absolutely, this is a bad idea!

I can sort of see the logic for Alfredo's example, but consider the inverse:

Bar OUT -> IN Zaz
Foo OUT -> IN Zazis either the equivalent of:

a)
Bar OUT -> IN[0] Zaz
Foo OUT -> IN[1] Zaz

or b)
Bar OUT -> IN[0] Zaz -- which is basically the same as -> IN Zaz (FBP
doesn't care!)
Foo OUT -> IN[0] Zaz -- ditto

If b) is what you want, there is no way to force it, except by specifying

-> IN[0] Zaz

explicitly, which is counter-intuitive, as most of the time IN Zaz will not
be an array!

On Sat, Sep 20, 2014 at 4:52 PM, Oleksandr Lobunets <
[email protected]> wrote:

Explicit specification of a port is part of the PEG grammar (
https://github.com/noflo/fbp/blob/master/grammar/fbp.peg). I think a
required order of declaration is a bad idea. At least in the Go version of
FBP DSL (https://github.com/oleksandr/fbp) version the indices should be
specified explicitly and the order does not matter.


Reply to this email directly or view it on GitHub
#22 (comment)
.

@oleksandr
Copy link
Member

@bergie I agree! And 👍 for the second point - the parser is just validating the given description against the grammar, the runtime is taking care of the rest...

@jpaulm Exactly! Well illustrated :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants