Zulip Chat Archive
Stream: lean4
Topic: Print memory representation for a structure type?
Geoffrey Irving (Feb 09 2024 at 11:52):
Is there an analogue of trace.compiler.ir.result
for the memory representation of a structure? E.g., if I do
@[unbox] structure Floating where
n : UInt64
s : UInt64
is there a way to print out what actually happened, to see that the type is 16 bytes?
Sebastian Ullrich (Feb 09 2024 at 12:01):
No but https://lean-lang.org/lean4/doc/dev/ffi.html has a mostly complete description
Sebastian Ullrich (Feb 09 2024 at 12:02):
[unbox]
is not implemented yet
Geoffrey Irving (Feb 09 2024 at 12:03):
Oh no!
Geoffrey Irving (Feb 09 2024 at 12:04):
Is there a tracking issue? https://github.com/leanprover/lean4/issues?q=is%3Aissue+is%3Aopen+unbox doesn’t show anything.
Sebastian Ullrich (Feb 09 2024 at 12:04):
I don't think so, it will be part of the compiler rewrite
Geoffrey Irving (Feb 09 2024 at 13:35):
Does unboxing work for a single field structure?
Geoffrey Irving (Feb 09 2024 at 13:35):
Geoffrey Irving (Feb 09 2024 at 13:36):
/-- 64-bit two's complement integers -/
@[unbox] structure Int64 where
n : UInt64
deriving DecidableEq, BEq
Henrik Böving (Feb 09 2024 at 14:25):
It will unbox on its own without the attribute
Last updated: May 02 2025 at 03:31 UTC