by viraptor · 16y ago · 0 comments
So... what is the complaint about records really?
You instead need to expand the old version of the record to avoid the problem. If you forget to, things will go wrong.
So yeah, they're ugly and get tricky in some areas of your programs, but they're still essential when you want a data structure with named fields AND pattern matching. You get used to them, but they're still considered a wart to many programmers.
Bar = Foo#foorecord.bar, Baz = Foo#foorecord.baz
it feels unnecessarily redundant. Shouldn't we already know Foo is a record of 'fake type' #foorecord? It's like a poor man's type system, and it's ugly.
Also, probably more importantly, since they're a compile-time trick you can't use them in the console, which makes experimentation and sometimes debugging harder.
#foorecord{bar=Bar, baz=Baz} = Foo
Readability depends on what does your brain process, when you see "=" ;)
> since they're a compile-time trick you can't use them in the console
Check the `rX` commands from http://www.erlang.org/doc/man/shell.html You can use the records just like in normal code, but you have to load them explicitly.