Haxe get() feature request

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Haxe get() feature request

Laurent Kappler
Hi,

Using the Hash table, I get the value with hash.get( 'fieldname' )

Could we have a second parameter 'defaultValue' for the case where the
value is null or none existant.

it would be very usefull in the case of params = Web.getParams();
params.get( 'aFormField', 'orUseThatValue' );

L

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Haxe get() feature request

Bill Moorier
Yes please!  I second this request.  I'm happy to do the work and send
a patch if that would help?

Cheers,
Bill.


On Wed, Nov 12, 2008 at 12:49 PM, laurent <[hidden email]> wrote:

> Hi,
>
> Using the Hash table, I get the value with hash.get( 'fieldname' )
>
> Could we have a second parameter 'defaultValue' for the case where the value
> is null or none existant.
>
> it would be very usefull in the case of params = Web.getParams();
> params.get( 'aFormField', 'orUseThatValue' );
>
> L
>
> --
> haXe - an open source web programming language
> http://haxe.org
>



--
Bill Moorier: http://abstractnonsense.com
VP Software Development, http://www.justin.tv

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Haxe get() feature request

Laurent Kappler
Yes!
+1

Commandant Cousteau

Bill Moorier a écrit :

> Yes please!  I second this request.  I'm happy to do the work and send
> a patch if that would help?
>
> Cheers,
> Bill.
>
>
> On Wed, Nov 12, 2008 at 12:49 PM, laurent <[hidden email]> wrote:
>  
>> Hi,
>>
>> Using the Hash table, I get the value with hash.get( 'fieldname' )
>>
>> Could we have a second parameter 'defaultValue' for the case where the value
>> is null or none existant.
>>
>> it would be very usefull in the case of params = Web.getParams();
>> params.get( 'aFormField', 'orUseThatValue' );
>>
>> L
>>
>> --
>> haXe - an open source web programming language
>> http://haxe.org
>>
>>    
>
>
>
>  


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Haxe get() feature request

Gustavs
I think the Python/PHP/etc kind of 'or' operator would work better.
(a or b = cast a ? a : b)

t.get (x) or "none"

read (...) or throw "error reading"

--
haXe - an open source web programming language
http://haxe.org