Ticket #136 (assigned enhancement)

Opened 2 years ago

Last modified 1 year ago

Simplified loop syntax

Reported by: dmckenna@… Owned by: scorfield
Type: enhancement Priority: normal
Milestone: Fusebox 5.6 Component: Miscellaneous
Version: 5.0 Severity: normal
Keywords: loop syntax Cc:

Description (last modified by scorfield) (diff)

Closely mirroring the CFML syntax for loop statements is a mistake I believe. The simplest way of doing it would be to have two main types of arguments:

<loop from="1" to="10" step="1" index="x"></loop>

<loop condition=""></loop>

<loop object="someData" index="x" from="10" to="20" delimiter=""></loop>

The first example is self explanatory, its basically a C for() loop and comparable to the current CFML syntax.
The second example is basically a while() loop and comparable to the current CFML syntax.
The third example is a bit more complex. The idea is to merge all of the list/query/collection functionality into one syntax and let Fusebox decide what CFML syntax to use; this will also make it easier for e.g. the PHP edition to cope. The 'from' and 'to' attributes then replace the startrow/endrow CFML cfloop-query attributes and would be extended to support other datatypes (yes, I did just say that). Lastly, the 'delimiter' attribute would be for lists and would default to a single comma, as is the CFML norm today.

One key aspect is that to KISS the developer should not have to differentiate between the type of incoming data, Fusebox should do that, and therefore we shouldn't be requiring a different attribute to define the index based on the type of incoming data.

Damien

Attachments

Change History

Changed 2 years ago by scorfield

  • owner changed from sean@corfield.org to scorfield
  • status changed from new to assigned
  • version changed from 5.1 to 5.0
  • description modified (diff)
  • milestone deleted

Whilst I can sympathize with wanting the index=/item= distinction to go away, I'm not (yet) convinced that the third suggested syntax is an improvement on the current CFML-like loop verb syntax.

Changed 2 years ago by scorfield

  • milestone set to Fusebox 6.0

Too big for 5.1 but I'll put it on the table for discussion for 6.0.

Changed 1 year ago by scorfield

  • milestone changed from Fusebox 5.5 to Fusebox 5.6

Defer for reconsideration.

Note: See TracTickets for help on using tickets.