xyncro / freya

Freya Web Stack - Meta-Package
https://freya.io
Other
330 stars 30 forks source link

MachineConfiguration is not strong typed #166

Closed mexx closed 5 years ago

mexx commented 8 years ago

During the implementation of #165 I run into the issue, that the configuration like Configuration.get Properties.LastModified is not strong typed and the type expected is determined by the code the value is bound too later. I've accidentally removed the Freya monad around the value and the compiler was happy, only the tests saved me from the misery :)

Couldn't the properties of the Configuration object be strongly typed?

kolektiv commented 8 years ago

The implementation in 3.0 assumes a lack of strong typing as any extensions to the graph need to be able to create their own configuration properties, which may or may not be present. As such, at the moment it's a fairly weak map implementation, and a box/unbox of the actual value.

However, that's not ideal as you've found, and for 4.0 i'm planning on changing it so that an extension or component of the graph can add a data type to a core map, so that rather than storing each individual property in the map, it stores a strongly typed data structure of multiple properties in the map, and gains safety that way.

So, the answer is yes - and for 4.0! I'll mark this as a 4.0 milestone issue :smile:

mexx commented 8 years ago

so that rather than storing each individual property in the map, it stores a strongly typed data structure of multiple properties in the map, and gains safety that way.

That was also my direction for the implementation, I'll try to send a PR. I mean if I get it managed before 3.0, it can go in it, right?

kolektiv commented 8 years ago

Hmm. I don't see why not! Yeah if you have a PR for that before 3.0 I don't see why I wouldn't take it :smile: