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

Cannot use prototype as @process #7

Open
kdambekalns opened this issue Jun 22, 2018 · 9 comments
Open

Cannot use prototype as @process #7

kdambekalns opened this issue Jun 22, 2018 · 9 comments

Comments

@kdambekalns
Copy link
Member

kdambekalns commented Jun 22, 2018

All of these do not work:

// -> literally "Acme.Com:Processor" as result
<a href={props.href} @process.foo="Acme.Com:Processor">

// -> Expression "Acme.Com:Processor" could not be parsed. Error starting at character 18: ":Processor".
<a href={props.href} @process.foo={Acme.Com:Processor}>

// -> Prop-assignment "@process.foo" was not followed by quotes or braces
<a href={props.href} @process.foo=Acme.Com:Processor>

But this would work in "pure" Fusion:

@process.tracking = Acme.Com:Processor
@Sebobo
Copy link
Member

Sebobo commented Nov 11, 2019

You can do

<a href={props.href}>
  <Acme.Com:Processor @path="process.foo"/>

@mficzel
Copy link
Member

mficzel commented Jan 21, 2020

@kdambekalns @Sebobo How about a syntax like this:

<a href={props.href} @process.foo=<Acme.Com:Processor/> >

This would allow to separate afx-attributes from expression and string attributes.

Another use case would be:

<Vendor.Site:TwoColumn 
   left=<Neos.Neos:ContentCollection nodePath="left"/>
   right=<Neos.Neos:ContentCollection nodePath="right"/>
/>

@Sebobo
Copy link
Member

Sebobo commented Jan 21, 2020

Personally I dislike the tag/prototype in an attribute style. JSX also doesn't allow it I think.

Just found out some days ago that XSL also does it the same way as AFX does it now. Have a child tag and apply its result to an attribute of the parent.

@mficzel
Copy link
Member

mficzel commented Jan 21, 2020

JSX would allow you to do this <a href={props.href} @process.foo={<Acme.Com:Processor/>} >

UPDATE: I was wrong jsx does'nt allow this yet
UPDATE2: Was wrong in beeing wrong. JSX supports this indeed

@Sebobo
Copy link
Member

Sebobo commented Jan 21, 2020

<a href={props.href} @process.foo={<Acme.Com:Processor/>} > looks a bit better than the other proposals IMO.

@mhsdesign
Copy link
Member

it could maybe be solved with <a href={props.href} @process.foo={afx:<Acme.Com:Processor/>} >...</a> as @mficzel pointed out in slack

@Sebobo
Copy link
Member

Sebobo commented Nov 16, 2021

Still don't like how the code looks when tags are contained in attributes.

@mficzel
Copy link
Member

mficzel commented Nov 16, 2021

@Sebobo JSX allows jsx in attributes like this:

<Foo stuff={<Bar />} />

In this regard it would make sense to allow an expression to contain afx again maybe like this:

afx`<Foo stuff={afx:<Bar />} />`

@mhsdesign
Copy link
Member

could be solved by my afx in eel approach similar to jsx: #28 (comment)
what do you think?

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

No branches or pull requests

4 participants