You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@AtnNn pointed out that we might just want to implement this and not #1856 (since r.expr({}).addFields('a', 1, 'b', 2) is just r.expr({}).merge(r.object('a', 1, 'b', 2)). I'd be cool with dropping addFields.
Also, r.object('a', 1, 'a', 2) should return {'a' : 2}.
@coffeemug You probably have some reason for why you want r.object() to behave like that. What is that reason? Is it a specific use case? I would think it should error in such cases.
Ah, I thought that r.object(i, j, k, m) should be equivalent to r.expr([[i, j], [k, m]]).coerceTo('object'), and I was under the impression that that accepts duplicates. Turns out it does not:
r.expr([['a', 1], ['a', 2]]).coerceTo('object')
RqlRuntimeError: Duplicate key a in coerced object.
So you're right, r.object('a', 1, 'a', 2) should return the same error.
Activity
coffeemug commentedon Jan 14, 2014
@AtnNn pointed out that we might just want to implement this and not #1856 (since
r.expr({}).addFields('a', 1, 'b', 2)is justr.expr({}).merge(r.object('a', 1, 'b', 2)). I'd be cool with droppingaddFields.mlucy commentedon Jan 14, 2014
I don't feel that strongly; let's just drop
add_fieldsto lessen the amount of work.coffeemug commentedon Jan 14, 2014
Also,
r.object('a', 1, 'a', 2)should return{'a' : 2}.danielmewes commentedon Jan 14, 2014
@coffeemug You probably have some reason for why you want
r.object()to behave like that. What is that reason? Is it a specific use case? I would think it should error in such cases.coffeemug commentedon Jan 14, 2014
Ah, I thought that
r.object(i, j, k, m)should be equivalent tor.expr([[i, j], [k, m]]).coerceTo('object'), and I was under the impression that that accepts duplicates. Turns out it does not:So you're right,
r.object('a', 1, 'a', 2)should return the same error.AtnNn commentedon Jan 15, 2014
This is implemented and in review 1127