flex-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mihai Chira (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FLEX-34880) Sort and SortField state setters are now behind mx_internal and out of the interfaces
Date Mon, 07 Nov 2016 19:04:59 GMT

    [ https://issues.apache.org/jira/browse/FLEX-34880?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15645090#comment-15645090

Mihai Chira commented on FLEX-34880:

It's not backwards compatible, although the same functions will be there, just behind mx_internal
and with casting if necessary. I don't think it can be perfectly backwards compatible because
after all this is about making Sort and SortField immutable, when now they are mutable. For
a reminder of the conversation, see [here|http://mail-archives.apache.org/mod_mbox/flex-dev/201505.mbox/%3CCAP1cEXG8%2BM1AXM_5CPVJseTpY3cppgRJY%2BnuHJ1gL-VcB%3D3z3A%40mail.gmail.com%3E].
You did express the (valid, of course) backwards compatibility concern, and suggested that
we at least hide the functions behind {{mx_internal}} to support the same code pattern. This
is what I am doing here. And eventually, after, say, two or three more releases, my idea is
to remove them altogether and leave the fully immutable coding pattern. If needed, we can
reopen the topic (on the mailing list perhaps) and see what's best.

> Sort and SortField state setters are now behind mx_internal and out of the interfaces
> -------------------------------------------------------------------------------------
>                 Key: FLEX-34880
>                 URL: https://issues.apache.org/jira/browse/FLEX-34880
>             Project: Apache Flex
>          Issue Type: Sub-task
>          Components: Spark: Sort and SortField
>    Affects Versions: Apache Flex 4.15.0
>            Reporter: Mihai Chira
>            Assignee: Mihai Chira
>             Fix For: Apache Flex 4.16.0
> h1. The change
> (Both mx and spark) {{Sort}} and {{SortField}} will be transitioned to immutable objects
to prevent bugs like FLEX-34853. In this step we are:
> # _removing the state setters from the interfaces_ ({{ISort}} and {{ISortField}}).
> # _hiding the state setters behind the {{mx_internal}} namespace_. This also implies
renaming them (because a getter and a setter with different namespaces throw a compile error).
The pattern is: {{public function set compareFunction(c:Function):void}} becomes {{mx_internal
function set compareFunction_(c:Function):void}}.
> h1. Usage
> h3. Before
> {code}
> var sortField:ISortField = new SortField();
> sortField.name = "title";
> sortField.descending = true;
> sortField.numeric = false;
> sortField.sortCompareType = SortFieldCompareTypes.STRING;
> sortField.compareFunction = titleCompareFunction;
> {code}
> h3. After; Version 1 (_preferred_)
> {code}
> var sortField:ISortField = new SortField("title", true, false, SortFieldCompareTypes.STRING,
> {code}
> h3. After; Version 2 (_deprecated, invalid in future versions_)
> {code}
> var sortField:ISortField = new SortField();
> SortField(sortField).mx_internal::name_ = "title";
> SortField(sortField).mx_internal::descending_ = true;
> SortField(sortField).mx_internal::numeric_ = false;
> SortField(sortField).mx_internal::sortCompareType_ = SortFieldCompareTypes.STRING;
> SortField(sortField).mx_internal::compareFunction_ = someCompareFunction;
> {code}

This message was sent by Atlassian JIRA

View raw message