Python from Wise Guy's Viewpoint

Pascal Costanza costanza at web.de
Mon Nov 3 08:47:37 EST 2003


Fergus Henderson wrote:

> Fergus Henderson <fjh at cs.mu.oz.au> writes:
> 
> 
>>Anyway, regarding how to write this example in a statically typed
>>language: you can do this in a quite straight-forward manner,
>>by just keeping a separate table of employees.
>>For example, here it is in Java.  
> 
> 
> And in case you didn't like the type declarations and downcast that you
> need in Java, here it is in Mercury.  

Thanks for the variations on this theme. However, your abstraction is 
still leaking.

> 			print("employed: " ++ (if !.Employees `contains` Joe
                                                   ^^^^^^^^^^^^^^^^^^^^^^
> 				then "yes" else "no")), nl,
> 			print("company: " ++
> 				!.Employees^det_elem(Joe)^company), nl,
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^
> 			print("salary: "),
> 			print(!.Employees^det_elem(Joe)^salary), nl,
                               ^^^^^^^^^^^^^^^^^^^^^^^^^

Pascal





More information about the Python-list mailing list