Add an address predicate

This commit is contained in:
Joshua Suskalo 2021-10-04 19:20:47 -05:00
parent 7d621f82db
commit 88b2a72f07
2 changed files with 10 additions and 0 deletions

View file

@ -2,6 +2,9 @@
All notable changes to this project will be documented in this file. This change log follows the conventions of [keepachangelog.com](http://keepachangelog.com/). All notable changes to this project will be documented in this file. This change log follows the conventions of [keepachangelog.com](http://keepachangelog.com/).
## [Unreleased] ## [Unreleased]
### Added
- An `address?` predicate
### Fixed ### Fixed
- `nil` was not considered a null pointer - `nil` was not considered a null pointer
- Primitive-serializing types fail to compile as arguments to downcall handles - Primitive-serializing types fail to compile as arguments to downcall handles

View file

@ -130,6 +130,13 @@
[addr] [addr]
(or (.equals (MemoryAddress/NULL) addr) (not addr))) (or (.equals (MemoryAddress/NULL) addr) (not addr)))
(defn address?
"Checks if an object is a memory address.
`nil` is considered an address."
[addr]
(or (nil? addr) (instance? MemoryAddress addr)))
(defn slice-global (defn slice-global
"Gets a slice of the global address space. "Gets a slice of the global address space.