Swift...

Pages: 12
closed account (10X9216C)
More locked down tools that only run and can be used for apple hardware.
More locked down tools that only run and can be used for apple hardware.

because windows has never done that, or linux for that matter

i dont have a mac so i cant try it :/ but here are some other noteworthy sites:
http://hacklang.org/
https://www.dartlang.org/
http://omfgdogs.com/
http://llvm.org/docs/tutorial/LangImpl1.html (<-- compiler building but still a neat site)(c++ edition)
http://llvm.org/docs/tutorial/OCamlLangImpl1.html (ocaml edition)
http://esolangs.org
Hooray!

Another language that looks like C++, works like C++ and uses C++ libs.
What's wrong with just using C++? I don't get it.

I don't understand the argument that it should make programming easier so that everyone can write "Apps". But usually the same people complain about crappy programs by lazy noobs.

Something doesn't fit here.

It's not the language that makes programming hard, it's the general understanding of computer architecture, operating system basics and memory management (even if it's handled by a GC).

OT: @Little Bobby Tables <-- XKCD reference! Kudos! :))
Last edited on
Another language that looks like C++, works like C++ and uses C++ libs.
What's wrong with just using C++? I don't get it.
Clearly you don't get it if you think that it looks like C++, works like C++ and uses C++ libs.
What I noticed about Swift: it has same problem with arrays like in almost all C-based languages!
Swift was introduced as high-level language. It has two basic built-in containers: dictionary (hash map) and arrays.
Dictionaries are passed by copy. Always.
Arrays shares their data when copied or passed into function and you can change shared values. But some modifying operations automaticly do .unshare, no questions asked.
Also immutable array means that you cannot change array size but can change array elements. Immutable dictionaries are true constant.

Some questions:
1) Why developers couldn't make normal COW implementation for arrays too, like they (presumably) did with dictionaries?
2) Why did they do automatic unshare on some operations? Because of that you can not rely on shring array state unless you memorized all operations which do unshare.
3) How to make a truly constant array?
1) Why developers couldn't make normal COW implementation for arrays too, like they (presumably) did with dictionaries?
Can you say why it is not normal?

2) Why did they do automatic unshare on some operations? Because of that you can not rely on shring array state unless you memorized all operations which do unshare.
As I understand it, the automatic unshare is carried out in operations that modify the array’s length.

3) How to make a truly constant array?
**shrugs**


edit:
NB: I have spent very little time skimming over some of the documentation.
Last edited on by Canis lupus
Can you say why it is not normal?
Only problem which comes to mind is multithreading issues.

As I understand it, the automatic unshare is carried out in operations that modify the array’s length.
Looks like that but unless you really read documentation and know that for sure, you still might tun into problems.

I just want to know why did not they choose one behavior: either copy or reference semantic?
I want to pass my array in third-party function. Can I be sure that it either will not touch my array or it will modify it and do not make unnesesary copy without having to look up documentation? With thing as they now, I can have modified array and another copy with different content.

3) How to make a truly constant array?
**shrugs**
We have constant dictionaries, why not arrays? Sometimes I do have data, I do not want to change.
Last edited on
plexus wrote:
Another language that looks like C++, works like C++ and uses C++ libs.
What's wrong with just using C++? I don't get it.

C++? How did you come to C++ with the sample code of:
1
2
3
4
5
var turbulence = SKFieldNode.NoiseFieldWithSmoothness(0.7, animationSpeed:0.8)
// OR
var sortedStrings = sort(stringArray){
      $0.uppercaseString < $1.uppercaseString
}

Seeing "var" makes me think Javascript up front. I'm sure other languages would come to mind if I looked at more code.
Seeing "var" makes me think Javascript up front
#define var auto /joke

Due to the language developing with these features in mind, syntax looks neat.
I hope the do have reflection here (which I miss sometimes in C++).
Interesting choice for iOS developers. Is there project to create cross compiler already? (Do not have anything from Apple, but still want to try)

Does anyone know if the want to develop Objective-C in parallel or want to phase it out?
I would imagine in parallel, but they may end up (in the future) phasing it out depending on the popularity.
Last edited on
Well. This seems like a mix of Javascript, C#, and C. Too bad I can't even code with it because I don't own a Mac computer. The language does look pretty neat though...
Swift took language ideas "from Objective-C, Rust, Haskell, Ruby, Python, C#, CLU, and far too many others to list".[1]

_________________________________________________________
[1] http://nondot.org/sabre/ (Chris Lattner's Homepage)
is there linux bindings for this?
@Little Bobby Tables
Not that I'm finding so far.
damn :/ seems like it would be fun to use
closed account (10X9216C)
because windows has never done that, or linux for that matter

You mean microsoft? Isn't really one entity that develops linux distros. There's a big difference between some and practically all. It's pretty much Apple's mentality that nothing else out there exists except for Apple.
yes i meant microsoft. my bad. and you misunderstood what i said. all three operating systems (ie windows, linux (specifically debian based distros), and mac osx) have software that only they can use, and also have software that can be used by all. for example, you say that comment about apple, yet fail to recognize clang and llvm. and just because its closed source right now doesnt mean it wont ever be
have software that only they can use

Obviously , softwares build on platform-specific frameworks won't run on other systems.
Further , Apple and Microsoft are business companies,
Apple developed Swift and Microsoft developed C# to aid developers/add to the software development toolkits for their respective OSs(and consoles :) ) and not as a community service.
One should differentiate them from organisations like Mozilla(rust ...) or even Google (go , dart ..).
Saying Linux has "locked down" software because there is software that only runs on Linux is like saying I'm locking all my code to x86 because I haven't gone to the effort of cross-compiling it for other architectures. In the case of most unported Linux software, all it would take is a bit of grappling with Autoconf or CMake or whatever. Even .Net was designed by Microsoft to be highly portable, they just didn't go to the trouble of porting it themselves. You can mention clang/llvm and cups, but neither of those projects were started by Apple, only acquired by them later. If they had locked them down, the open source community would have just forked an earlier version like they did with Solaris and OpenOffice when Oracle bought Sun. I don't know any project Apple has created from scratch by themselves that isn't closed-source and hardware-locked. It's kinda dumb really, because even MS releases Office for OS X -- not out of some kind of goodness, but because people with Macs have money that they probably aren't spending on Office for Windows.

[edit]
Besides that, this language doesn't really look very innovative. It just looks like a strongly-typed, unmanaged Javascript.

Also
It includes low-level primitives such as types, flow control, and operators

Types, flow control and operators are "low-level" now? Assembly language doesn't have "types", types are an abstraction; assembly languages have numbers, smaller numbers and bigger numbers. Most CPUs don't really even distinguish between signed and unsigned integers. It does have flow-of-control, in that the CPU is able to execute one instruction and then execute a different one, but that's not quite the same as if/while/for/etc., and I doubt Swift's flow-of-control works by modifying a register (directly). As for operators, assembly doesn't really have those either (except for pre-computed offsets). It has operations, but they're not quite the same.
Last edited on
Pages: 12