add hint that @field() works differently on types and values

This commit is contained in:
Paul Ebose 2026-02-27 03:48:11 +01:00
parent 3ecaa34271
commit 2e981d408f
No known key found for this signature in database
GPG Key ID: EF7590319BD845B1

View File

@ -118,6 +118,10 @@ fn printTuple(tuple: anytype) void {
// @field(foo, "x"); // returns the value at foo.x
//
// The first field should print as: "0"(bool):true
//
// Hint: Be careful! If your 'lhs' is a type, @field() looks
// for declarations. If it's a value, it looks for data.
//
print("\"{s}\"({any}):{any} ", .{
field.???,
field.???,