Skip to content

Commit

Permalink
The #= on Symbol and String should be symmetric
Browse files Browse the repository at this point in the history
- it’s only defined in String
- there’s no hint that it should behave differently in Symbol which is a subclass
- so, we really should just consider the string content when comparing #foobar = ‘foobar’

Signed-off-by: Stefan Marr <[email protected]>
  • Loading branch information
smarr committed Jan 13, 2023
1 parent 5f52eef commit afe38e8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/som/primitives/SymbolPrimitives.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import { Primitives } from './Primitives.js';

import { universe } from '../vm/Universe.js';
import { SString } from '../vmobjects/SString.js';

function _asString(_frame, args) {
return universe.newString(args[0].getString());
Expand All @@ -35,6 +36,10 @@ function _equals(_frame, args) {
if (op1 === op2) {
return universe.trueObject;
}

if (op1 instanceof SString && op1.getEmbeddedString() === op2.getEmbeddedString()) {
return universe.trueObject;
}
return universe.falseObject;
}

Expand Down

1 comment on commit afe38e8

@rebenchdb
Copy link

@rebenchdb rebenchdb bot commented on afe38e8 Jan 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Performance changes for d825cf0...afe38e8

Summary Over All Benchmarks
Summary Over All Benchmarks

Full Report

Please sign in to comment.