Stephane Ducasse wrote:
http://smalltalkhub.com/#!/~CAR/ReusableBricks/packages/Equals
Ah. It uses trait that does it dynamically. Good to know, usable for some more dynamic scenarios; but here I wanted something more explicit a la existing "generate xxx", so I went for Alistair's suggestion, so it was just a matter of Playground and: (RBGenerateEqualHashRefactoring className: PharktSymbol variables: #(baseAsset quoteAsset)) execute Thanks. (btw, it would be nice if that was actually in a menu; but if Nautilus if phased out, at least in Calypso in Pharo 7 :-) ) Herby
On Thu, Feb 8, 2018 at 12:47 PM, Herbert VojÄÃk<herby@mailbox.sk> wrote:
Alistair Grant wrote:
Hi Herby,
On 8 February 2018 at 03:10, Herbert VojÄÃk<herby@mailbox.sk> wrote:
Hi!
Do you think it would be reasonable to have, a la "generate accessors" / "generate initialize method", a "generate equality" thingie that would generate #= and #hash for the method, mechanically?
Just created a new "piece of data" class and felt like it would be helpful.
The refactoring browser is already capable of generating #= and #hash:
Now somebody tell me it actually is there in the Nautilus menu, I just did not find it. Which would be the best outcome, save making myself ridiculous online... :-)
| r |
r := RBGenerateEqualHashRefactoring className: MyClass variables: #(vars which should be used in equal and hash). r execute
HTH, Alistair