Hey,
I am new here and I overcome this problem, I am trying to split a string, so I googled some swift solution and I found this var fullNameArr = split(fullName) {$0 == " "}
what is not working in Silver at all, because I have to write it like this var splitted = content.Split(" ") what is C#
I thought that I can use Swift programming language in VS when I have Silver, but this syntax is different. So maybe I just do not understand what Silver actually is.
split() is a function in the base library, not a part of the a Swift language syntax, per se. We’re working on expanding the base library to cover most of the common APIs such as this one eventually, but it’s not quite there yet as we’ve been foremost focused on the compiler itself. The silver base library will also be open source on github, so Silver users can contribute and help expand it for full coverage.
content.Split() is not C#, it’s a method exposed by the .NET Steing class, available tegardless of the language used. So if course it’s available in Swift as well. It’so important to distinguish between C# (which is a language,must like Swift is) and .NET (which is a platform and set if types that expose certain APIs — regardless of language used).
i think that would probably make it even more confusing, because then you can’t even know what to expect just from looking at the code even if you are fully aware of how Swift does this. But i’ll bring it up for consideration.
We can/should certainly improve error message to make this more clear when you run into this case.
That wasn’t a terribly detailed proposal on my part. What I’m thinking is a switch that makes parameter name use a choice for user of the function instead of the definer. So in that case external names are always available (be it through a default or explicit external name) and are always optional. The user can then pass parameters by position or name as they see fit. There would have to be a rule when interleaving them, such as named parameters can only come after positional parameters or named parameters are not counted when determining a positional parameter’s index.