![]() Making `equal?` do the right thing on classes turned out to be easy---it just involved adding a straightforward `prop:equal+hash` property to the `class` struct—but making it work properly for *objects* was the tricky part. The trouble is that `equal?` on objects that don’t implement the `equal<%>` interface is just ordinary structure equality, which can be relevant if objects are inspectable. Writing `(inspect #f)` in a class body is like making a struct `#:transparent`, and it has all the same ramifications for equality. The trouble is that `class/c` creates new wrapper classes, and every class has its own struct type. Since the default behavior of `equal?` on structs is to *never* be equal to structs of different types, even subtypes, an object created from a contracted class can never be `equal?` to an object created from the same class without contracts. The solution is to add a `prop:equal+hash` property to `object%` itself that emulates the default behavior of `equal?`, but sees through class contract wrappers. Since struct type properties are inherited by subtypes, this property will be present on all objects, and it only needs to be attached once. fixes #2279 |
||
---|---|---|
.github/ISSUE_TEMPLATE_DRAFT | ||
.gitlab | ||
pkgs | ||
racket | ||
.gitattributes | ||
.gitignore | ||
.gitlab-ci.yml | ||
.mailmap | ||
.travis.yml | ||
appveyor.yml | ||
azure-pipelines.yml | ||
INSTALL.txt | ||
Makefile | ||
README.md |
This is the source code for the core of Racket. See "INSTALL.txt" for full information on building Racket.
To build the full Racket distribution from this repository, run make
in the top-level directory. To build minimal Racket, run make base
.
The rest of the Racket distribution source code is in other repositories, mostly under the Racket GitHub organization.
Contribute to Racket by submitting a pull request, joining the development mailing list, or visiting the IRC channel.
License
Racket is distributed under the GNU Lesser General Public License (LGPL). This implies that you may link Racket into proprietary applications, provided you follow the rules stated in the LGPL. You can also modify Racket; if you distribute a modified version, you must distribute it under the terms of the LGPL, which in particular states that you must release the source code for the modified software.
See racket/src/COPYING_LESSER.txt for more information.