assignments:a2
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| assignments:a2 [2009/04/02 04:05] – jonathan | assignments:a2 [2009/04/05 02:11] (current) – removed jonathan | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Assignment 2 ====== | ||
| - | |||
| - | |||
| - | Download the file a2-money.zip in '' | ||
| - | |||
| - | Since your code will be executed and checked with a script, you must follow the instructions precisely. Your work is in a directory '' | ||
| - | |||
| - | Before submitting, eclean and do a fresh compile and execute to make sure that you get a green bar. Then eclean the directory '' | ||
| - | |||
| - | | ||
| - | |||
| - | Don't forget to also hand in your written report at the 3311 drop box in the CSE building. | ||
| - | |||
| - | ---- | ||
| - | ---- | ||
| - | |||
| - | ===== void safety and HASH_TABLE [?G, ?K]===== | ||
| - | |||
| - | * We would like to use HASH_TABLE[G, | ||
| - | * Eiffelstudio 6.3 is in transition to implementing void safety (which means that the compiler will always catch errors of the type '' | ||
| - | * The latest version of HASH_TABLE inherits from TABLE [?G, ?K], i.e. the generic parameters are allowed to be attached to Void. So, to use HASH_TABLE in HASHABLE_MAP, | ||
| - | |||
| - | <code eiffel> | ||
| - | class | ||
| - | | ||
| - | inherit | ||
| - | | ||
| - | create | ||
| - | make | ||
| - | feature | ||
| - | has (k: ? | ||
| - | |||
| - | item alias " | ||
| - | |||
| - | | ||
| - | |||
| - | | ||
| - | |||
| - | feature{NONE} | ||
| - | | ||
| - | end | ||
| - | </ | ||
| - | |||
| - | The question mark will ensure that the keys and values can be Void. you may sometimes have to do the following to obtain a correct tuple type: | ||
| - | |||
| - | <code eiffel> | ||
| - | t: TUPLE[KEY, | ||
| - | |||
| - | t ?= [map_imp.key_for_iteration, | ||
| - | </ | ||
| - | |||
| - | "? | ||
| - | |||
| - | ===== Future versions of Eiffel ===== | ||
| - | |||
| - | In the next version of EiffelStudio, | ||
| - | <code eiffel> | ||
| - | t: T | ||
| - | </ | ||
| - | t is attached. You will have to explicitly say | ||
| - | |||
| - | <code eiffel> | ||
| - | t: ?T | ||
| - | </ | ||
| - | if you want to allow '' | ||
| - | |||
| - | Fow now, we can follow the advice above if we want to use HASH_TABLE. | ||
| - | |||
assignments/a2.1238645135.txt.gz · Last modified: by jonathan
