Re: Null check property expression syntax

2011-08-26 Thread Josh Canfield
> I'm kinda disappointed here, I came here with a valid issue and no one seems > to see a problem here, No, You came with a valid issue and an alternative solution was provided. > I just want a syntax option improvement which will avoid some > behavior/performace issues. The problem is that we

Re: Null check property expression syntax

2011-08-26 Thread Thiago H. de Paula Figueiredo
On Fri, 26 Aug 2011 05:56:07 -0300, Denis Stepanov wrote: Guys, Hi! I'm kinda disappointed here, I came here with a valid issue and no one seems to see a problem here, I don't want to fix it in my project we are already using ifNotNull component I just want a syntax option improvemen

Re: Null check property expression syntax

2011-08-26 Thread Denis Stepanov
Guys, I'm kinda disappointed here, I came here with a valid issue and no one seems to see a problem here, I don't want to fix it in my project we are already using ifNotNull component I just want a syntax option improvement which will avoid some behavior/performace issues. It could pretty muc

Re: Null check property expression syntax

2011-08-24 Thread Denis Stepanov
> Definitely. I'd rather add the Object -> Boolean and appropriate other > coercions instead of adding a feature to the property expressions. > > I'm adding them to my personal project now. I'll be happy to add them > to the framework once the dust of this thread settles :) I'm afraid it will bre

Re: Null check property expression syntax

2011-08-24 Thread Josh Canfield
> There is, let say "address" is a Boolean Boolean -> Boolean is a nonsense coercion, the typecoercer actually checks if the type is assignable from the source type and returns the input unchanged. These: Long --> Boolean String --> Boolean Already exist. Since they are a better match than Objec

Re: Null check property expression syntax

2011-08-24 Thread Denis Stepanov
> Is there any reason for Tapestry-IoC or Tapestry-core themselves not > providing a direct Object -> Boolean coercion? There is, let say "address" is a Boolean then you can't check for null, because if it is null it will return false and if it isn't could be false too. It will not work for defa

Re: Null check property expression syntax

2011-08-24 Thread Thiago H de Paula Figueiredo
e it directly now while Tapestry-IoC doesn't, so I against applying your patch while I agree with the performance enhancement. Cheers! Thiago -- View this message in context: http://tapestry.1045711.n5.nabble.com/Null-check-property-expression-syntax-tp4726386p4731096.html Sent from the Tapestry -

Re: Null check property expression syntax

2011-08-24 Thread Lenny Primak
I am having the same kind of issues. +1. On Aug 24, 2011, at 11:54 AM, Denis Stepanov wrote: >> Or do something like user?.address?.property > > > Would it be better to use just "user?.address?" without contributing coercion > for every object in a project? :) > > We already have ifNotNul

Re: Null check property expression syntax

2011-08-24 Thread Denis Stepanov
> Or do something like user?.address?.property Would it be better to use just "user?.address?" without contributing coercion for every object in a project? :) We already have ifNotNull component I'm just trying to make Tapestry better :) Text search revealed that we have 99 matches of

Re: Null check property expression syntax

2011-08-24 Thread Ulrich Stärk
Or do something like user?.address?.property Uli On 24.08.2011 16:38, Ulrich Stärk wrote: > Just contribute your own coercion from Object -> Boolean. > > On 24.08.2011 16:23, Denis Stepanov wrote: >>> "X doesn't do what I want" is not a strong argument. In order to convince >>> someone to apply t

Re: Null check property expression syntax

2011-08-24 Thread Ulrich Stärk
Just contribute your own coercion from Object -> Boolean. On 24.08.2011 16:23, Denis Stepanov wrote: >> "X doesn't do what I want" is not a strong argument. In order to convince >> someone to apply the patch, you need to make more efforts to describe you >> issue. After reading all of your mails I

Re: Null check property expression syntax

2011-08-24 Thread Denis Stepanov
> "X doesn't do what I want" is not a strong argument. In order to convince > someone to apply the patch, you need to make more efforts to describe you > issue. After reading all of your mails I'm still not sure what is the issue > with existing syntax. Please explain exactly your use case. As alwa

Re: Null check property expression syntax

2011-08-24 Thread Igor Drobiazko
Denis, "X doesn't do what I want" is not a strong argument. In order to convince someone to apply the patch, you need to make more efforts to describe you issue. After reading all of your mails I'm still not sure what is the issue with existing syntax. Please explain exactly your use case. As alwa

Re: Null check property expression syntax

2011-08-24 Thread Thiago H. de Paula Figueiredo
On Wed, 24 Aug 2011 10:52:29 -0300, Denis Stepanov wrote: As I wrote before, "!" doesn't do what I want, object needs to be converted to a boolean first: - null is converted to false - unknown not null is converted to a string by calling toString metod and then string is converted to a b

Re: Null check property expression syntax

2011-08-24 Thread Denis Stepanov
As I wrote before, "!" doesn't do what I want, object needs to be converted to a boolean first: - null is converted to false - unknown not null is converted to a string by calling toString metod and then string is converted to a boolean ToString method is usually implemented for debug purposes

Re: Null check property expression syntax

2011-08-24 Thread Denis Stepanov
I have implemented null check see: https://issues.apache.org/jira/browse/TAP5-1615 can be used with propertyChain expressions: "prop?", "prop.a.b?.c?", "method()?". Denis

Re: Null check property expression syntax

2011-08-23 Thread Denis Stepanov
> I think a more useful extension would be the Groovy :? operator > > expression ?: default-value > > This could even be combined with the safe de-reference: > > foo?.bar?.baz ?: computeFooBarBaz() Elvis operator is a nice feature to have too, but it's something different, I just would like

Re: Null check property expression syntax

2011-08-23 Thread Howard Lewis Ship
I think a more useful extension would be the Groovy :? operator expression ?: default-value This could even be combined with the safe de-reference: foo?.bar?.baz ?: computeFooBarBaz() BTW, existing syntax would do fine for you On Tue, Aug 23, 2011 at 4:41 AM, Denis Stepanov wrote

Re: Null check property expression syntax

2011-08-23 Thread Denis Stepanov
> How does it differ from existing syntax? See the examples here: > propertyChain : term '.' propertyChain > | term '?.' propertyChain > | term; Right now you can only check if property is a null when chaining to another property to prevent a NPE. Maybe even better

Re: Null check property expression syntax

2011-08-23 Thread Igor Drobiazko
How does it differ from existing syntax? See the examples here: http://tapestry.apache.org/property-expressions.html On Tue, Aug 23, 2011 at 1:14 PM, Denis Stepanov wrote: > Hello, > > I would like to suggest a new syntax for checking if the property > expression value is a null: > > > value="?p

Null check property expression syntax

2011-08-23 Thread Denis Stepanov
Hello, I would like to suggest a new syntax for checking if the property expression value is a null: > value="?prop" will return false if property "prop" is null or true if not > value="?prop.a.b.c" will return false if property "c" is null or true if not > value="?prop?.a?.b?.c" will ret