Is Swift the language that Go should have been /g/?
>>59919990
Not really, but it is objectively better than Go in pretty much every way.
>>59919990
most underrated language of the last decade
its pretty much native c#, and its fucking awesome at least from my small experience with it
>>59919990
No, Crystal is the language that golang should have been.
Not necessarily by syntax or even in all semantical concepts, but in what is included.
>>59920596
still no windows support
>>59920356
google "swift read file by line"
the examples convinced me that swift is pure shit.
>>59919990
Yes. It has all the modern features and isn't retarded like Go.
>>59919990
No native concurrency
>>59921052
hello pajeet.let lines = contents.components(separatedBy: "\n")
for line in lines {
let words = line.components(separatedBy: " ")
print("\(words[0]) is \(words[1]) and likes \(words[4])")
}
>>59921052
you're an idiot. stick to java.
If you could use Switch to make Mac/iOS apps without having to interface with a thousand legacy NS* Objective-C libraries it'd be great.
>>59921031
and the problem is what exactly?
I've used both.
Go is a much better language.
t. Someone who has a degree in C
>>59920026
I C what you did there.
>>59921171
>Degree in C
Quality education
Redpill me on switch
Why use it instead of c+++
>>59921171
>degree in C
kek
Apple did something good?
>>59921440
It's Mainstream (top 10 on Pypl), and it has algebraic data types.
>>59921111
>contents
now where does it come from, retard?
>>59921130
pythonwith open(fname) as f:
content = f.readlines()
# you may also want to remove whitespace characters like `\n` at the end of each line
content = [x.strip() for x in content]
rubyFile.readlines('foo').each do |line|
swift
https://gist.github.com/algal/23b10062a558aec7679e4c854096f88e
java is another stupid example when you need IO stream and shit.
>>59921647
>swift
but that's juts wrong you stupid retard. go scroll up.
like I said, stick to fucking java... and poo in the loo.
>>59921730
Are you brain dead?
That "scroll up" example is about splitting string by delimiter.
>>59919990
is it useful anywhere outside apple's walled garden?
>>59923795
>is it useful anywhere outside apple's walled garden?
Of course. IBM wrote millions of lines of code in Swift for their servers.
Swift was probably the only time I've ever had fun programming for an iOS device.
>>59923869
looks like you're right
thanks anon, didn't know about that
>>59921604do {
let contents = try String(contentsOfFile: "/path/to/file");
}
catch let error {
}
>>59923948
Yeah, IBM is moving everything over to Swift now. They used to be big on Java but now they're branching out.
https://realm.io/news/tryswift-chris-robert-end-to-end-application-development-swift-backend/
Pic related.
>>59921031
good, this keeps the plebs out
With 1.0 they will have that soon enough anyway.
>>59924073
> benchmarksgames
>>59924675
this
Anyone who takes that plebian shit serious...
>>59924063
>>59921111
I really like how all arguments in Swift are named. It's one thing Obj-C got right.
>>59919990
I need my C for loop
>>59921031
>>59920596
And no support for building shared libraries.
>>59924771
Good, I'll never see "YourDevWasALazyFag.dll is missing, please install it." messages again.
>>59924813
They still plan on having a code loading/plugin mechanism, just a language-specific one. So you could still see "YourDevWasALazyFag.totally_not_a_dll is missing". On the other hand, you won't be able to write plugins in Crystal for existing applications with a API C without manually creating a C shim.
>>59924933
That actually sounds good.
The C ABI is limited garbage and really shouldn't be encouraged to be used except for extreme cases, like hard realtime stuff and if A wants B to use As plugin API he better delivers some kind of workaround framework like for example I believe Qt does.
>>59925086
Ideally, they should have both.
>>59924933
>YourDevWasALazyFag.fusion
>>59925109
Nah, that just encourages people to create bindings for shitty scripting languages in which they then attempt to write actual applications.
>>59925156
You misunderstand me. You can already use shitty scripting languages all you want in a Crystal program because you can load C shared libraries. Crystal is designed to make it easy to use C libraries. What you can not do is write a shared library in Crystal to extend a shitty scripting language with.
>>59919990
Go is the language Swift should have been.
>>59927316
Thoughtless inversion.