[Laszlo-dev] Feature proposal: $accept{} [Was: lz.colors question]
P T Withington
ptw at pobox.com
Fri Nov 14 13:17:42 PST 2008
http://jira.openlaszlo.org/jira/browse/LPP-7343
On 2008-11-14, at 15:15EST, Max Carlson wrote:
> Sounds good, though perhaps accept could be clearer - it's really
> type-sensitive parsing... I can't think of anything better at the
> moment.
>
>
> -----Original Message-----
> From: P T Withington <ptw at pobox.com>
> Sent: Friday, November 14, 2008 11:55 AM
> To: Max Carlson <max at openlaszlo.org>
> Cc: J Crowley <jcrowley at laszlosystems.com>; Platform Team <platform-team at laszlosystems.com
> >; Laszlo-dev bug reporting <laszlo-dev at openlaszlo.org>
> Subject: Re: [Platform-team] lz.colors question
>
> But he should also be able to say:
>
> bgcolor="iceblue"
>
> and/or
>
> bgcolor="${this.acceptValue('iceblue', 'color')}"
>
> Which might be more instructive. In the first case, you are
> specifying a constant color, and since bgcolor is an attribute with a
> type of `color` the token `iceblue` is acceptable as a value (not
> tested). In the second case, you are using a constraint, and (at
> least as of now), constraints are simply expressions that _directly_
> set the value of an attribute -- they _do_not_ pass through the data
> interface, which converts string representations into values according
> to type. (I think this is desirable.) So, in the second case, I am
> calling the (currently unpublished) `acceptValue` method, which takes
> a string representation of a value and parses it according to the
> specified type.
>
> There should be a better way. Perhaps I should be able to say:
>
> bgcolor="$accept{'iceblue'}"
>
> (meaning use acceptValue and the attribute's declared type to parse
> the value of the expression)? We've already got $path and $style, why
> not $accept (unless someone can come up with a better name). I think
> this would allow me to say something like:
>
> <inputtext id="color" />
> <view bgcolor="$accept{color.text}" />
>
> would that be useful?
More information about the Laszlo-dev
mailing list