In the [ConfigFile+Subscript.swift] there are subscription for the class ConfigFile.
I got errors in the get-set because Int, Int8... Int64 to not conforms to to FloatingPoint Protocol, but the Unsigned type does.
There's a reason for that?
And there is a simple way to bypass the problem?
For the love of me, I couldn't get your project structure to work with current Xcode so I don't really know what' going on. But no integer types (including unsigned ones) conform to FloatingPoint. Did you add those conformance yourself?
Ok, created a fork of the project and uploaded it...
the repository is GitHub - Chetral/Smud: MUD Server for Swift
the problem is in this file: Sources/Smud/ConfigUtils/ConfigFile+Subscript.swift
So far I've taken the original project (Smud/smud) and updated the language structure.
The original project is splitted in several Module, since all of them are 4 years old, instead of forking (exist in english?) them all I have directly added them to the project.
Right now the project do not compile due to the problem of this topic, maybe there are some other issues...
Let's clear the misunderstanding first. The unsigned versions works fine, not becauseUInt* conform to FloatingPoint. As I said, they are not. The reason it works is because the conform to UnsignedInteger, and you provided that the function in ConfigFile.swift: line 290. Then for Int version, it couldn't find anything, and just guess that another one for FloatingPoint in ConfigFile.swift: line 281 is the closest version (which still doesn't match), hence the error.
Now, I don't know the exact semantic of your ConfigFile, but I have two plausible suggestions:
Extend the UnsignedInteger version mentioned above to a more general BinaryInteger, which encompasses both signed and unsigned version.
As you said.
I added:
// correction for set get -- Swift forum Lantua
public func set(_ name: String, _ value: T?) where T: SignedInteger{
if let value = value {
set(name, String(describing: value))
} else {
reset(name)
}
}