[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: string.dump(f, true) does not work as expected
- From: Roberto Ierusalimschy <roberto@...>
- Date: Wed, 10 Jun 2015 14:51:42 -0300
> I'd agree with this, unless the bytecode loader absolutely depends on it
> for some reason. But I'd probably call that a design bug, anyway.
Of course, anyone is free to call whatever they want a design bug. But
I really fail to see why you think that string.dump should give equal
results for functions that the language itself consider different:
local function f(x) return x+1 end
local function g(y) return y+1 end
print(f == g) --> false
Even if the functions were equal according to the language, string.dump
still could give different results. For instance, it saves constants
by dumping their memory contents. Sometimes a constant type need
padding (e.g., long double on many Intel CPUs). Instructions themselves
sometimes do not use all fields; like padding, unused fields are free
to have any random garbage. That random content can make the result of
string.dump non deterministic. Why would that be a bug?
-- Roberto