This seems like it could be a pretty valuable tool, but what about objects 
that implement valueOf() specifically so arithmetic can be performed on them 
(such as Date)? This is something restricter doesn't currently allow, but 
appears as though it would be extremely valuable, at least in the case that 
the two operands have the same constructor:

var date1 = new Date(2011, 2, 5),
    date2 = new Date(2011, 2, 1),
    time = date1 - date2,
    days = time / (1000 * 60 * 60 * 24); 
console.log(days.toString(10) + " days");

"restricter mode" code will throw an exception for date1 - date2. Obviously 
you *could* do:

time = date1.valueOf() - date2.valueOf();

but that seems like throwing away a great convenience that the language 
gives you.

-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/[email protected]/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/[email protected]/

To unsubscribe from this group, send email to
[email protected]

Reply via email to