I Break Your Code: No More Uninitialized Variables
[Thread Prev] | [Thread Next]
[Date Prev] | [Date Next]
- Subject: I Break Your Code: No More Uninitialized Variables
- From: Ori Bernstein <ori@xxxxxxxxxxxxxx>
- Date: Fri, 11 Dec 2015 22:52:28 -0800
- To: myrddin-dev@xxxxxxxxxxxxxx
Variables must now be initialized before use.
This was the case before now, but the compiler checks as of today. This
code is no longer valid:
const f = {
var x
use(x)
}
This has already led to fixing two bugs in the standard distribution.
The change breaks one legitimate use from libstd, and I'd be open to clean
ways to fix it, since it's already ugly:
var dummy : mytype
std.fmtinstall(std.typeof(dummy), fmtfunc)
For now, I worked around it by initializing a few spurious values and free
them when installing format funcs.
I'm currently thinking that the entire introspection API needs an overhaul.
--
Ori Bernstein
| Re: I Break Your Code: No More Uninitialized Variables | Ryan Gonzalez <rymg19@xxxxxxxxx> |
- Next by Date: Re: I Break Your Code: No More Uninitialized Variables
- Next by thread: Re: I Break Your Code: No More Uninitialized Variables
- Index(es):