2 ms·
I've written many languages (starting with ML –Machine Language). I'm currently developing in Swift, and loving it. I wrote PHP for about 20 of its 25 years.
by ChrisMarshallNY 6y ago
I've written many languages (starting with ML –Machine Language).
I'm currently developing in Swift, and loving it.
I wrote PHP for about 20 of its 25 years. I never really got to love the language, but got fairly good with it. I don't miss it much.
I have used it to write some industrial-scale systems, though. It's a perfectly good language, and is still under active development and improvement; with a vast user base and [m|b]illions of pages of support.
Even though a lot of us like to live on "the bleeding edge," I've found that it's a good idea to stick with the classics for shipping code.
Nowadays, "the classics" includes JS and Python, so there are definitely good, well-supported, mature alternatives to PHP.
I also programmed C++, and ran a C++ shop, for many years. I always find the hate poured onto C++, with the annual "C++ is dead" pronouncement, quite amusing.
But I really like Swift.
- cutler 6y agoI tried to like Swift but with Perl as my first language Swift's regex implementation made me want to throw up. That and having to escape opening brackets and double parameter definitions. I just don't get the love for Swift other than it being an improvement over Objective C.
- ChrisMarshallNY 6y agoI consider Perl to be a “write-only” language. Damn good text processor, though. I wrote an entire CMS in Perl, back in the late 90s. I still wake up, screaming... Swift isn’t any worse than most modern languages, when it comes to text processing, but that’s not what I use it for. In fact, it has some very powerful string handling, built-in, but it’s kind of weird, if you are used to more traditional languages.
- cutler 6y agoI never got the "write-only" criticism. If you understand a language thoroughly code is always readable. What's with the insane double param naming? And why do I have to escape and opening paren? No other language requires this.
- ChrisMarshallNY 6y agoIt’s designed to allow functions to have “two faces.” One face is the one presented to the caller, and the other to the function, itself. The idea is to maximize grokability. The function’s purpose and argument list is clear to the caller. It’s an attempt at that old “philosophers’ stone” of “self-documentation.” Almost all the code I encounter has little to no method interface documentation. This is supposed to address that. My experience is that many people circumvent it by using the “wildcard” (_). I use it to add “in” prefixes to my parameters, like so: func churn(butter inButter: String) {...} The “in” prefix means nothing, outside the function context, but is an indicator that it is a function parameter, inside the function. However, outside the function, the parameter name makes it clear that what is to be churned, is butter, as this is the published signature: func churn(butter: String) It also allows us to use parameters that are published with the names of class properties, without name collisions. For example: init(butter inButter: String) { butter = inButter } Where using just “butter” would mean we need to do this: init(butter: String) { self.butter = butter } Small stuff, but Swift has a lot of these types of considerations. But what is really cool about function parameters, is that we can “skip” optional parameters, like so: func add(numberOne inFirst: Int = 0, numberTwo inSecond: Int = 0, numberThree inThird: Int = 0, to inTarget: Int) { return inFirst + inSecond + inThird + inTarget } We can call it like so: let result = add(numberThree: 4, to: 5) I write about that sort of thing, here: https://littlegreenviper.com/miscellany/swiftwater/swift_functions/ https://littlegreenviper.com/miscellany/swiftwater/swift_fun... It’s an enormously flexible language, and can be used to write almost inscrutable code, if we choose. However, it can also be used to write extremely readable code. I think it’s a sisyphean exercise, trying to get programmers to write readable code, but we keep trying. Like I said, Swift is a bit like C, where it can be used to write obfuscated junk, if the programmers want. My experience is that “idiomatic Swift,” as prescribed by many authorities, is starting to look like that. I’m not exactly sure what you mean by “escape an opening paren.” Do you mean inside of strings? That’s a direct inline shorthand that is similar to `...` in other languages. Totally optional. For example: print(“There are \(numberOfSheep) sheep.”) is direct, as opposed to print(“There are “ + numberOfSheep + “ sheep.”), or print(“There are “, numberOfSheep, “ sheep”).
- 6y ago
- Cthulhu_ 6y agoI enjoyed working with Swift, and I did enjoy working on Objective-C as well back when; my main gripe with Swift is that it's still a niche language for niche applications, unfortunately, and only really practical in a Mac environment. XCode is great though, I miss working with it. I miss the browser-like swipe-to-go-back operation. I did set up a theme similar to Midnight in IntelliJ though.
- ChrisMarshallNY 6y agoYes, but it is the prescribed language for native applications (like C#). Java is really becoming a “niche” language for Android development (until it is replaced with something like Go or Dart). We are seeing less and less of it for server code, as Python and JS take over. C++ is becoming “niche” for engine code. I’m glad it’s no longer really used for UI. There’s a lot of specialized languages popping out of the woodwork, these days. I once worked with an image processing language called Halide, which I found to be quite painful (it’s basically an FP language with the good parts removed), but an interesting idea. Totally niche. https://halide-lang.org/ https://halide-lang.org/