Fix === operator to check for type equality, changes to == behaviour

Description

This code run from a REPL outputs true, false because it checks to see if the two variables are the same objects in memory. The === has been widely accepted to perform a type check in languages like JavaScript however (which would return true in both cases).

Change the === operator to check for value equality and type equality instead. This will bring Lucee more in line with other languages and will be a much more useful operator in a dynamic language.

It's also worth noting, that this change will be loosening the current definition so no existing code will start returning false that currently returns true. I personally think anyone using it thought it was doing a type check all along (if anyone has, in fact, been using this).

Breaking Changes

this also affects the == operator with complex objects to match ACF, see

Activity

Pothys - MitrahSoft 
12 June 2023 at 07:56

I've checked this ticket with lucee version 6.0.0.451-SNAPSHOT. Now === operator are works fine and the issue is solved.

Michael Offner 
9 June 2023 at 15:57

Zac Spitzer 
14 October 2022 at 11:42

(disabled)

Zac Spitzer 
2 May 2022 at 17:18

I’ve closed the linked ticket as it’s a duplicate

has just blogged about this

Fixed

Details

Assignee

Reporter

New Issue warning screen

Before you create a new Issue, please post to the mailing list first https://dev.lucee.org

Once the issue has been verified, one of the Lucee team will ask you to file an issue

Sprint

Fix versions

Priority

Created 20 April 2017 at 20:20
Updated 16 June 2023 at 15:36
Resolved 12 June 2023 at 07:57