Ara.T.Howard <ahoward / ngdc.noaa.gov> wrote:
> On Sat, 22 Nov 2003, Yukihiro Matsumoto wrote:
> 
> <snip>
>> |Then specify the contract in a separate file ...
>> |
>> |   class Person
>> |     def greet:pre(other_person)
>> |       assert ! self.married?
>> |       assert ! other_person.married?
>> |     end
>> |
>> |     def greet:post(other_person)
>> |       assert other_person.married?
>> |       assert self.married?
>> |       assert_equal self, other_person.spouse
>> |       assert_equal other_person, self.spouse
>> |     end
>> |   end
>> 
>> I'd be second to Chad.  Cool.
>> 
>> |An aside: Unfortunately, the post method doesn't have access to the result
>> |returned from the function.  In this case it doesn't matter, but many post
>> |conditions assert something interesting about the result.  I guess I would
>> |have to use a wrap method for that.
>> 
>> The only reason the result is _not_ available from post method is we
>> don't have neat syntax construct.  Any proposal?
> <snip>
> 
>  class Person
>    def greet:post other_person #=> result
>      assert other_person.married?
>      assert self.married?
>      assert_equal self, other_person.spouse
>      assert_equal other_person, self.spouse
>    end
>  end
> 
> 
>  * '#=>' is it's own token, therefore no confusion with hash or comment

That would break a *lot* of code that uses it as a means to annotate an
expression.

If we are introducing a new multichar token, why not -> ?

martin