v0.4.1
When we declare methods inside a struct object in our Zig source code, in some specific cases we have to use a "pointer to struct" in the self
argument of our struct object, instead of using "copy to struct" in this self
argument. In other words, in some specific cases, we have to pass the struct object by reference, and not by value, to the method. This affects only the self
argument in methods of struct objects.
So, if you have a struct named User, and you declare a method inside this struct, a method of this struct might need to use self: *User in it's arguments, instead of the usual self: User.
In this release, we added a section to the book to explain this type of situations, and why we would use self: *x
instead of self: x
on struct methods.
What's Changed
- Remove format specifier that doesn't exist in Zig at the debugging chapter.
- Add section to explain the difference between
self: x
andself: *x
by @pedropark99 in #22
Full Changelog: v0.4.0...v0.4.1