diff --git a/CHANGELOG.md b/CHANGELOG.md index 9121605..c7838f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,43 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [3.2.0] - 2025-08-31 + +### Added + +#### Strict Equality Operators + +- **New Operators**: Added `===` (strict equality) and `!==` (strict inequality) operators +- **Type-Safe Comparisons**: Strict operators compare both value and type, unlike loose equality +- **Round-Trip Preservation**: Operators maintain their exact form during parse/decompile cycles +- **Complete Pipeline Support**: Full lexer, parser, evaluator, and visitor implementation +- **Comprehensive Testing**: 23 tests covering all aspects of strict equality functionality + +#### Examples + +```elixir +# Strict equality - same type and value required +Predicator.evaluate("5 === 5", %{}) # {:ok, true} +Predicator.evaluate("5 === '5'", %{}) # {:ok, false} - different types + +# Strict inequality - true when type or value differs +Predicator.evaluate("5 !== '5'", %{}) # {:ok, true} - different types +Predicator.evaluate("1 !== true", %{}) # {:ok, true} - different types + +# Operator distinction preserved +Predicator.parse("x = y") |> elem(1) |> Predicator.decompile() # "x = y" +Predicator.parse("x == y") |> elem(1) |> Predicator.decompile() # "x == y" +Predicator.parse("x === y") |> elem(1) |> Predicator.decompile() # "x === y" +``` + +#### Technical Implementation + +- **Lexer**: Added `:strict_equal` and `:strict_ne` token types with proper precedence +- **Parser**: Extended comparison grammar to support strict operators +- **Evaluator**: Added `STRICT_EQ` and `STRICT_NE` instruction handlers +- **StringVisitor**: Added decompilation support for round-trip accuracy +- **Type Safety**: Works with all data types including `:undefined` values + ## [3.1.0] - 2025-08-30 ### Added diff --git a/README.md b/README.md index d67eb51..cbb3203 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ Add `predicator` to your list of dependencies in `mix.exs`: ```elixir def deps do [ - {:predicator, "~> 3.1"} + {:predicator, "~> 3.2"} ] end ``` diff --git a/mix.exs b/mix.exs index ddeefbb..a61648c 100644 --- a/mix.exs +++ b/mix.exs @@ -2,7 +2,7 @@ defmodule Predicator.MixProject do use Mix.Project @app :predicator - @version "3.1.0" + @version "3.2.0" @description "A secure, non-evaling condition (boolean predicate) engine for end users" @source_url "https://github.com/riddler/predicator-ex" @deps [