3 ms·
> This is a fun idea, but it generates comments that are typically the ones which should not exists in actual code, because they do not add any useful informati
by BulgarianIdiot 5y ago
> This is a fun idea, but it generates comments that are typically the ones which should not exists in actual code, because they do not add any useful information
The point is attaching meta info to values which aren't pointless. Say:
weight = 42 /* pounds */;
It's kinda like types, but without the type checks. I'm not purely sarcastic, because boxing values within objects so they have a type has drawbacks.
That said, there are better way of typing values without boxing them.
- sparsely 5y agoF# does exactly this, except it understands the rules of units cancelling etc.
- Anunayj 5y agoWoah TIL. I've been looking for a similar language, something that I can do Physics in without having to worry about units/constants. Till now I've used WolframAlpha or just Google. Do you think F# is suited for this, or do you suggest other alternatives?
- sparsely 5y agoF# definitely has the most complete implementation that I've seen, I'm sure other languages would let you hack something together though. https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/units-of-measure https://docs.microsoft.com/en-us/dotnet/fsharp/language-refe...