"Fix" return types of BIFs that return "true" for no real reason

Description

One of the odd things about CFML is

Change the following BIFs to always return the original data structure in Boxlang. For CF code, modify the transpiler to detect if the BIF’s return value is used, and if so wrap it in an IIFE that returns the dummy true value for CF compat.

  • arrayAppend()

  • arrayClear()

  • arrayDeleteAt()

  • arrayInsertAt()

  • arrayResize()

  • arraySet()

  • arraySwap()

  • StructClear()

  • StructKeyTranslate()

  • StructInsert()

  • structAppend()

  • QuerySetRow()

  • QueryDeleteRow()

  • QuerySort()

  • ArrayPrepend()

The following BIFs return something other than the original data structure, but they have a good reason for doing so. Leave them as-is.

  • queryAddColumn() -- returns index of the column removed

  • queryAddRow() -- returns the row number added

The following BIF returns the query in Adobe which we’ll match. Lucee returns the array of removed data, but we’re just ignoring that for now since we agree with Adobe’s behavior.

  • QueryDeleteColumn()

These 2 BIFs actually have the ability to return true or false, not just a hard-coded true. Fix like the first big list, but instead of hard coding the dummy true value, actually match the original BIF behavior from CF code.

  • arrayDelete() -- return true if the array is smaller after the delete operation

  • structDelete() -- return true if indicateNotExisting was provided as an arg, and set to true, and the key being deleted existed prior to deletion.

You can visualize what the transpiler is doing by taking a CF source file and transpiling it to a Boxlang source file. For example, this CF code

transpiles into this BoxLang code:

But a statement not being set into a variable, passed as an argument, or used as a condition in a flow control statement, will remain unchanged since the return value is ignored.

Activity

Show:
Fixed
Pinned fields
Click on the next to a field label to start pinning.

Details

Assignee

Reporter

Fix versions

Priority

Sentry

Created July 16, 2024 at 11:37 PM
Updated July 17, 2024 at 6:22 PM
Resolved July 16, 2024 at 11:39 PM