[#796] Re: value of assignment (Re: Order of the value of an expression changed? (PR#579)) — Sean Chittenden <sean@...>
> sean@chittenden.org wrote:
Hi,
> |I have read the thread and I think this is a pretty bad change. I
Hi,
> > #BEGIN test.rb
Hi,
Hi --
Hi,
Hi --
Hi,
Hi,
Hi,
what about if attr_accessor :foo defined three methods - #foo, #foo=, and
> |What was wrong with having the receiver set the return value though?
Sean Chittenden <sean@chittenden.org> writes:
> > f = Foo.new()
>>>>> "J" == J Herre <jlst@gettysgroup.com> writes:
On 11 Feb 2003 at 11:13, Sean Chittenden wrote:
[#801] class of $1, $2 in 1.8.0 — dblack@...
Hi --
Hi,
Hi --
Hi,
Hi --
J.Herre <jlst@gettysgroup.com> writes:
Hi --
On Sat, 8 Feb 2003 06:52:17 +0900
Hi --
On Friday, February 7, 2003, at 03:15 PM, dblack@candle.superlink.net
[#851] Alternate GC ? — Mathieu Bouchard <matju@...>
[#875] OpenSSL for Ruby 0.2.0-pre0 — Michal Rokos <michal@...>
Hi everybody!
[#889] Bob Jenkins' hashing implementation in Ruby — Mauricio Fern疣dez <batsman.geo@...>
>>>>> "M" == Mauricio Fern疣dez <Mauricio> writes:
On Sat, Mar 01, 2003 at 08:42:40PM +0900, ts wrote:
>>>>> "M" == Mauricio Fern疣dez <Mauricio> writes:
On Sat, Mar 01, 2003 at 10:03:47PM +0900, ts wrote:
>>>>> "M" == Mauricio Fern疣dez <Mauricio> writes:
On Sat, Mar 01, 2003 at 10:10:35PM +0900, ts wrote:
Hi,
[#890] String and (repost) MemLeak — Michal Rokos <michal@...>
Hi,
Hi,
Hi,
Hi,
Hi,
Re: value of assignment (Re: Order of the value of an expression changed? (PR#579))
On Wed, 12 Feb 2003, Pit Capitain wrote: > Yes, this is true. I see your point. But, at least for me, after > o.quality = 999'999 > it feels strange that > o.quality == 100 > The auto-adjust code might be handy if you always know what you're > doing, but it could also hide some errors in your program. I think if > I'd want to auto-adjust instead of raising an error, I would code it > like this: > def adjust_to_percent( value ) > [[value,0].max,100].min > end > percent = o.quality = adjust_to_percent( 999'999 ) > to make it obvious whats going on. This is the old debate between implicitness and explicitness. I am not sure whether I would actually code that way. I'm always keeping automatically generated GUI's in mind, and for some reason I had thought that making it auto-adjust would be good, but now I'm no longer very sure... My actual solution to that problem is more like: 1. Make a type declaration for the :quality property. Its type would be either 0..100 or And[Integer,0..100] depending on circumstances. 2. Optionally check the validity of the value assigned to the property. I consider it a good thing to modularize type-checking out of type-declaration, which explains the "optional" here. The reason for that modularization is that type-decls are useful in other circumstances (marshalling... runtime help... automatic GUI generation... etc) 3. Actual policies of auto-adjust (and other recovery strategies) are a responsibility of the GUI controls (or of a common library of policies being used by the GUI library) I've been thinking almost like this for a while but hadn't taken the time to clarify my ideas... I'm still not to sure about the auto-adjust, because automatic casting is one kind of auto-adjust (it's just that it recreates the value as being of a different class instead of the same class), and I'm not necessarily willing to make it go away, and think that all kinds of auto-adjusting should be done at the same level. Many general software design questions still unsolved... ________________________________________________________________ Mathieu Bouchard http://artengine.ca/matju