solnic changed the topic of #rom-rb to: Ruby Object Mapper | Mailing List: https://groups.google.com/forum/?fromgroups#!forum/rom-rb | Logs: http://irclog.whitequark.org/rom-rb
mbj has quit [Ping timeout: 245 seconds]
_whitelogger has joined #rom-rb
cored has quit [Ping timeout: 252 seconds]
mbj has joined #rom-rb
mbj has quit [Ping timeout: 246 seconds]
mbj has joined #rom-rb
CraigBuchek has joined #rom-rb
CraigBuchek has quit [Quit: Leaving.]
mbj has quit [Ping timeout: 245 seconds]
mbj has joined #rom-rb
dkubb has joined #rom-rb
<mbj> dkubb: hi
<mbj> dkubb: Very happy ;)
<dkubb> mbj: sweet! congratulatios
<mbj> dkubb: thx
<dkubb> so rubyspec contains most of the weird edge cases
<mbj> dkubb: Stuff that depends on reproducing the magic encoding header is excluded.
<mbj> dkubb: I'd have no idea how to reproduce it.
<dkubb> I guess at this point if it's not in rubyspec, then it's not an actual part of the spec and more a side effect of the implementation
<mbj> dkubb: Scanning all str nodes, looking for encodings would be an option.
<mbj> dkubb: Here is the list of exclusions https://github.com/mbj/unparser/blob/master/rubyspec.sh
<mbj> dkubb: All of these depend on reproduction of the magic encoding header.
<dkubb> ahh ok
<dkubb> does parser not expose it?
<mbj> Not explicitly.
<mbj> Indirectly via the encoding of the string children of str nodes.
<dkubb> I would expect parser to see it, and then change some state that affects the ast production while parsing the file
<mbj> Exactly. I'd need to scan the AST on how str nodes are actually encoded.
<mbj> But TBH, I'm probably gonna saw: Unparser only supports UTF-8 files.
<mbj> s/saw/say/
<dkubb> each ast node should almost have a slot saying what the encoding was when it was created
<dkubb> I think that's fine
<mbj> node = s(:str, "foo")
<mbj> node.children.first.encoding would work
<mbj> It reflects the encoding mode parser was in while parsing.
<dkubb> right, but you don't necessarily always have a string node in the ast
<mbj> Yeah.
<dkubb> I guess the encoding header only affects string nodes though, or does it?
<mbj> I'll probably also affect nodes that use str nodes internally.
<mbj> regexp, xstr
<mbj> and dsym
<mbj> also I'd expect sym reflects the encoding.
<mbj> But you can also have an .rb files without any of these.
<mbj> BTW: 10e100000000 gets internally represented as s(:int, Infinity)
<mbj> While preprocessing I catch these and replace it with the AST for Float::INFINITY
<dkubb> I wonder if I should do that in sql
<dkubb> *do that kind of thing
<dkubb> when parsing literal numbers, I need to maintain the precision, so I'm probably going to encode :float nodes using BigDecimal
<dkubb> at least internally in the parsed ast
<mbj> I needed to do this to support normalize(parse(source)) == normalize(parse(generate(normalize(source))))
<mbj> Because the nature how parser works is asymetric.
<dkubb> BigDecimal is a bit annoying in how it evaluates 2E3, it'll expand it to 2000.0
<mbj> Its probably a good choice NOT to map to the native ruby primitives.
<dkubb> yeah?
<mbj> As you did, mapping float to BigDecimal.
<mbj> I agree here.
<dkubb> I had another idea about making a number object that can losslessly represent the literal numbers
<mbj> You dont need to do calulus. So this is also a nice idea.
<dkubb> BigDecimal is probably good enough for :float. I think Integer can represent :integer though
<mbj> *calculus
<mbj> dkubb: I'm gonna add the rubyspec round trip as an integration spec to unparser. Than release and see how much unparser releated bug reports come in.
<mbj> dkubb: We could add more code to the self test. But I think rubyspec should be enough.
<mbj> dkubb: I'm currently debugging this one: https://travis-ci.org/mbj/unparser/jobs/16787435
<mbj> dkubb: IMHO this is a bug in rubinius internals.
<mbj> dkubb: Yeah rbx bug: ary = [1, 2, 3, 4]; *head, tail = ary; # now ary will be [1, 2, 3]
<mbj> dkubb: this is not an issue on rbx head.
<dkubb> mbj: normally you'd see the head get one element and tail slurp in all the others, like: head, *tail = [1, 2, 3, 4]
<dkubb> oh, I see, art is modified by that assignment
<dkubb> *ary
<mbj> dkubb: Yeah assignment of partitioned array had a side effect.
<mbj> dkubb: Fixed in rbx head, so I did not report.
<mbj> dkubb: the key "D" of my laptop just broke. Ordered replacment key.
<mbj> dkubb: Its really nice these days you can buy a single key.
mbj has quit [Quit: leaving]