Branch: refs/heads/topic/robin/runtime-types
Home:
https://github.com/zeek/spicy
Commit: 3a78f6987d082488a33a36be37dff2864493a860
https://github.com/zeek/spicy/commit/3a78f6987d082488a33a36be37dff2864493a860
Author: Robin Sommer <
ro...@corelight.com>
Date: 2025-10-21 (Tue, 21 Oct 2025)
Changed paths:
M hilti/runtime/include/types/bitfield.h
M hilti/runtime/include/types/null.h
M hilti/runtime/include/types/optional.h
M hilti/runtime/include/types/struct.h
M hilti/runtime/include/types/tuple.h
M hilti/runtime/src/tests/optional.cc
M hilti/toolchain/src/compiler/codegen/coercions.cc
M hilti/toolchain/src/compiler/codegen/operators.cc
M hilti/toolchain/src/compiler/jit.cc
M spicy/runtime/src/init.cc
M spicy/runtime/src/parser.cc
Log Message:
-----------
New `Optional` implementation.
So far the runtime used `std::optional` for representing optionals.
This commit replaces that with a custom `Optional` class that
encapsulates the implementation, and directly provides the semantics
we want. That means in particular that we can now remove most of the
former free functions, and move their functionality directly into the
class. For example, the `value()` method now throws the expected HILTI
exception directly, without needing to remember to use a wrapper. We
also rename some method to follow our coding conventions.
Behind the scenes, we continue to use `std::optional` for implementing
optionals, now through protected inheritance, similar like we do for
some other types as well.
This is all similar to how we already wrap other `std` types into
custom runtime types (e.g., vector).
To unsubscribe from these emails, change your notification settings at
https://github.com/zeek/spicy/settings/notifications