Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
September 24, 2006 We have 'void' (no type),but we don't have 'any' (any type). | ||||
---|---|---|---|---|
| ||||
any opIndex(char[] key) { if(auto x=key in strarr) return cast(char[])*x; else if(auto y=key in intarr) return cast(int)*y; else if(auto z=key in bolarr) return cast(bool)*z; else throw new Exception("key not found: '" ~ key ~"'"; } |
September 24, 2006 Re: We have 'void' (no type),but we don't have 'any' (any type). | ||||
---|---|---|---|---|
| ||||
Posted in reply to nojoking | but we have 'Box' in std.boxer. |
September 24, 2006 Re: We have 'void' (no type),but we don't have 'any' (any type). | ||||
---|---|---|---|---|
| ||||
Posted in reply to nojoking | nojoking wrote: > any opIndex(char[] key) > { > if(auto x=key in strarr) > return cast(char[])*x; > else if(auto y=key in intarr) > return cast(int)*y; > else if(auto z=key in bolarr) > return cast(bool)*z; > else > throw new Exception("key not found: '" ~ key ~"'"; > } That's because D isn't a dynamically-typed language. Stewart. -- -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS/M d- s:-@ C++@ a->--- UB@ P+ L E@ W++@ N+++ o K-@ w++@ O? M V? PS- PE- Y? PGP- t- 5? X? R b DI? D G e++++ h-- r-- !y ------END GEEK CODE BLOCK------ My e-mail is valid but not my primary mailbox. Please keep replies on the 'group where everyone may benefit. |
September 24, 2006 Re: We have 'void' (no type),but we don't have 'any' (any type). | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tom S | Tom S wrote:
> but we have 'Box' in std.boxer.
Is it still broken, btw? I'm still using dmd 0.160, so I'm just curious.
|
September 24, 2006 Re: We have 'void' (no type),but we don't have 'any' (any type). | ||||
---|---|---|---|---|
| ||||
Posted in reply to nojoking | >> nojoking wrote: >> We have 'void' (no type),but we don't have 'any' (any type). Ehm... We have 'Any' type --> please see announcement newsgroup :-) -- Regards Marcin Kuszczak (Aarti_pl) |
Copyright © 1999-2021 by the D Language Foundation