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

Sub expression as named parameter #2140

Closed
organic-scholar opened this Issue Dec 15, 2015 · 11 comments

Comments

Projects
None yet
2 participants
@organic-scholar

organic-scholar commented Dec 15, 2015

stache template with following experssion throws error Unable to understand expression.

{{ greet name=(uppercase username) }}

both greet and uppercase are helpers

@organic-scholar organic-scholar changed the title from Nested expression as named parameter to Sub expression as named parameter Dec 15, 2015

@justinbmeyer

This comment has been minimized.

Show comment
Hide comment
@justinbmeyer

justinbmeyer Dec 15, 2015

Contributor

This isn't valid syntax. Write it like:

{{ greet name=uppercase(username) }}

Sent from my iPhone

On Dec 15, 2015, at 8:12 AM, nauman notifications@github.com wrote:

stache template with following experssion throws error Unable to understand expression

{{ greet name=(uppercase username) }}
both greet and uppercase are helpers


Reply to this email directly or view it on GitHub.

Contributor

justinbmeyer commented Dec 15, 2015

This isn't valid syntax. Write it like:

{{ greet name=uppercase(username) }}

Sent from my iPhone

On Dec 15, 2015, at 8:12 AM, nauman notifications@github.com wrote:

stache template with following experssion throws error Unable to understand expression

{{ greet name=(uppercase username) }}
both greet and uppercase are helpers


Reply to this email directly or view it on GitHub.

@organic-scholar

This comment has been minimized.

Show comment
Hide comment
@organic-scholar

organic-scholar Dec 15, 2015

Thanks for quick response its working. but do you add support for follwing syntax.

{{ greet name=(uppercase username) }}

after all it is valid syntax.

organic-scholar commented Dec 15, 2015

Thanks for quick response its working. but do you add support for follwing syntax.

{{ greet name=(uppercase username) }}

after all it is valid syntax.

@justinbmeyer

This comment has been minimized.

Show comment
Hide comment
@justinbmeyer

justinbmeyer Dec 15, 2015

Contributor

@organic-scholar it's not valid stache syntax. We decided we liked:

{{ greet name=uppercase(username) }}

more than the handlebars syntax.

Contributor

justinbmeyer commented Dec 15, 2015

@organic-scholar it's not valid stache syntax. We decided we liked:

{{ greet name=uppercase(username) }}

more than the handlebars syntax.

@organic-scholar

This comment has been minimized.

Show comment
Hide comment
@organic-scholar

organic-scholar Dec 18, 2015

Please check this
(http://jsbin.com/bopateq/1/edit?html,js,console,output)

i tried the above syntax its not working

organic-scholar commented Dec 18, 2015

Please check this
(http://jsbin.com/bopateq/1/edit?html,js,console,output)

i tried the above syntax its not working

@justinbmeyer justinbmeyer reopened this Dec 18, 2015

@justinbmeyer justinbmeyer added the bug label Dec 18, 2015

@justinbmeyer justinbmeyer added this to the 2.3.8 milestone Dec 18, 2015

@justinbmeyer

This comment has been minimized.

Show comment
Hide comment
@organic-scholar

This comment has been minimized.

Show comment
Hide comment
@organic-scholar

organic-scholar Dec 18, 2015

But right now we can't mix helper expression with call expression.

organic-scholar commented Dec 18, 2015

But right now we can't mix helper expression with call expression.

@justinbmeyer

This comment has been minimized.

Show comment
Hide comment
@justinbmeyer

justinbmeyer Dec 18, 2015

Contributor

I'm pretty sure you can mix helper and call like: {{#each foo(bar)}}, but it seems that a helper hash doesn't work with a call expression like: {{helper hash=call()}}. It's a bug we will fix for the next release.

Contributor

justinbmeyer commented Dec 18, 2015

I'm pretty sure you can mix helper and call like: {{#each foo(bar)}}, but it seems that a helper hash doesn't work with a call expression like: {{helper hash=call()}}. It's a bug we will fix for the next release.

@organic-scholar

This comment has been minimized.

Show comment
Hide comment
@organic-scholar

organic-scholar Dec 18, 2015

here is another example failing, this one with unnamed params.

http://jsbin.com/niseji/edit?html,js,console,output

organic-scholar commented Dec 18, 2015

here is another example failing, this one with unnamed params.

http://jsbin.com/niseji/edit?html,js,console,output

@justinbmeyer

This comment has been minimized.

Show comment
Hide comment
@justinbmeyer

justinbmeyer Dec 18, 2015

Contributor

Works: http://jsbin.com/xotunitoya/edit?html,js,console,output

So, there really isn't a problem. The confusion is that the results of call expressions are passed as computes to helper expressions.

Helper expressions get computes by default.

Sent from my iPhone

On Dec 18, 2015, at 10:40 AM, nauman notifications@github.com wrote:

here is another example failing, this one with unnamed params.

http://jsbin.com/niseji/edit?html,js,console,output


Reply to this email directly or view it on GitHub.

Contributor

justinbmeyer commented Dec 18, 2015

Works: http://jsbin.com/xotunitoya/edit?html,js,console,output

So, there really isn't a problem. The confusion is that the results of call expressions are passed as computes to helper expressions.

Helper expressions get computes by default.

Sent from my iPhone

On Dec 18, 2015, at 10:40 AM, nauman notifications@github.com wrote:

here is another example failing, this one with unnamed params.

http://jsbin.com/niseji/edit?html,js,console,output


Reply to this email directly or view it on GitHub.

@organic-scholar

This comment has been minimized.

Show comment
Hide comment
@organic-scholar

organic-scholar Dec 20, 2015

but i think this behaviour is inconsistent beacuse we called the expression its is not instead it is passed as compute.

organic-scholar commented Dec 20, 2015

but i think this behaviour is inconsistent beacuse we called the expression its is not instead it is passed as compute.

@justinbmeyer

This comment has been minimized.

Show comment
Hide comment
@justinbmeyer

justinbmeyer Dec 20, 2015

Contributor

Helpers are always passed a compute with any observable data. Even functions are converted to a compute. So it's consistent.

Sent from my iPhone

On Dec 20, 2015, at 5:34 AM, nauman notifications@github.com wrote:

but i think this behaviour is inconsistent beacuse we called the expression its is not instead it is passed as compute.


Reply to this email directly or view it on GitHub.

Contributor

justinbmeyer commented Dec 20, 2015

Helpers are always passed a compute with any observable data. Even functions are converted to a compute. So it's consistent.

Sent from my iPhone

On Dec 20, 2015, at 5:34 AM, nauman notifications@github.com wrote:

but i think this behaviour is inconsistent beacuse we called the expression its is not instead it is passed as compute.


Reply to this email directly or view it on GitHub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment