Swift Algorithms
swift.org
Swift Algorithms
1–10 of 80 posts
Re: Swift Algorithms
#2Re: Swift Algorithms
#3Worse nomenclature than any other big language I can think of, including Go and Python. Why should this package be called "algorithms"?
Whether C++ is a good model to follow is another question entirely, of course! But at least Swift isn’t being completely idiosyncratic in its naming choices.
Re: Swift Algorithms
#4Worse nomenclature than any other big language I can think of, including Go and Python. Why should this package be called "algorithms"?
C++ has similar nomenclature - - the std::algorithms library has generic functions for working with collections: https://en.cppreference.com/w/cpp/algorithm Whether C++ is a good model to follow is another question entirely, of course! But at least Swift isn’t being completely idiosyncratic in its naming choices.
Re: Swift Algorithms
#5Worse nomenclature than any other big language I can think of, including Go and Python. Why should this package be called "algorithms"?
Of course technically any part of a program is an algorithm, but usually (like here) we reserve the name for general things like here (from path and graph to partition and search algorithms), not for our "business logic" algorithm.
Re: Swift Algorithms
#6Re: Swift Algorithms
#7Worse nomenclature than any other big language I can think of, including Go and Python. Why should this package be called "algorithms"?
Re: Swift Algorithms
#8Worse nomenclature than any other big language I can think of, including Go and Python. Why should this package be called "algorithms"?
Re: Swift Algorithms
#9One issue with Go's lack of generics is exactly that it can't have such a package (and have it be type safe, fast, and work across all relevant types), except with repeated code.
Re: Swift Algorithms
#10One issue with Go's lack of generics is exactly that it can't have such a package (and have it be type safe, fast, and work across all relevant types), except with repeated code.
Sounds to me like a job for a DSL that compiles down to Golang for the final output. That way, the repeated code only exists in the Golang output and not in the code that humans actually write.
more specifically, fairly basic operations on a list of data does not seem like it should call for the complexity of a DSL. IMO unless you need to do this quite a bit on random datatypes, copy & paste would probably be the better alternative. Unless you're referring to a DSL that looks exactly like Golang but with generics & monomorphism.... in which case ok I guess