Skip to main content
13 events
when toggle format what by license comment
Aug 18, 2016 at 12:17 comment added Dan So, a key-value store is what you're after, basically? Without encoding information about the type you store, yes, this is indeed impossible in any type system without type sniffing at runtime. It's just static type systems will complain more loudly about it.
Aug 18, 2016 at 11:43 comment added ksl @DanPantry Ultimately I want to put properties in a map. The key is the property name, which is a unique string. That values of the properties can be different types.
Aug 18, 2016 at 11:12 comment added Dan why do you need this? Answerers have given you bodgy ways of doing it, but what is your end purpose here?
Aug 18, 2016 at 10:37 answer added Joop Eggen timeline score: 1
Aug 18, 2016 at 8:45 comment added Heslacher I have rolled back the last edit. Please see what you may and may not do after receiving answers.
Aug 18, 2016 at 8:45 history rollback Heslacher
Rollback to Revision 2
Aug 18, 2016 at 8:44 history edited ksl CC BY-SA 3.0
Update following response.
Aug 17, 2016 at 20:57 answer added Pimgd timeline score: 3
Aug 17, 2016 at 17:06 comment added ksl I'm not sure I understand your question about how I know it's a float/String/Integer. The magical class would give me a compile time error if I tried to assign a returned property value to the wrong type (rather than a runtime error).
Aug 17, 2016 at 16:39 comment added Pimgd Need more context to answer this one; How do you know it's a float/String/Integer right now? What would a magical class that would give you the value already casted give you as benefit? This looks like a design issue to me and I don't see a solution without knowing the use cases.
Aug 17, 2016 at 16:08 history edited ksl CC BY-SA 3.0
edited body
Aug 17, 2016 at 16:06 review First posts
Aug 17, 2016 at 18:46
Aug 17, 2016 at 16:01 history asked ksl CC BY-SA 3.0