Follow Slashdot stories on Twitter

 



Forgot your password?
typodupeerror
×

Comment Re:Because no one else does (Score 1) 260

Huh?

Swift is a strongly typed language, though it uses type inference to reduce the amount of characters typed by the developer. Types can be provided explicitly, and for numeric types, specific sized elements such as UInt8 or Int32 can be used.The type engine also provides for Optional valued types; an optional value can be dereferenced with a ? or ! depending on whether the value is expected to exist. The collections in Swift provide literal support for both arrays (with []) and dictionaries/maps (with [:]) and can include generic types.

and

Swift is a strongly-typed language by default; however, it also uses type inference which again reduces code length for developers. The strong type attribute is always in place unless specified by special keyword weak.

Comment Re:Because no one else does (Score 1) 260

It's a combination of fashion, libraries, how big is the improvement over the nearest commonly used competitor, commercial backing, luck, and yes technical merit.

For example, Perl is a language that succeeded on the basis of its powerful string manipulation primitives, which is technical merit, and in spite of its many other technical deficiencies.

Comment Re:Because no one else does (Score 1) 260

"Fast" is such a vague term as to be meaningless

If only someone could invent an objective measure of speed of execution, using a newly developed unit which we shall call "microseconds" and use that to compare the performance.

On a more serious note, I agree that for many applications time is not that important, but there are many others for which it is. The rendering engine in the browser is one. Any app running in a battery constrained phone is another.

Comment Because no one else does (Score 4, Interesting) 260

The reason why companies develop new languages is because the ones coming from academia are focused on the wrong things. Product development requires an industrial strength, strongly typed (for the most part) fast language.

Projects coming from academia are interpreted, JVM based, functional, obsessed with (im)mutability, closures, and lambda functions.

This is not to say those things are not nice, however they are not central to a programming language as used in large scale industrial systems.

Comment Re:Due to stupid security warnings, security (Score 1) 208

type-safety in that "we never add 3 to a string" is only a limited version of what type declaration does. For example, let's say I accidentally have a real variable where I meant it to be an integer, and because of overloading the code never breaks. Yet there is a bug there since my mental model says that i is an integer and sooner or later in my code I will do something incorrect with it which might or might not be caught by the type-inference engine.

On the other hand a statically typed language will catch it right away. and say you said i was an integer, how come you are using it to catch a real value?

Think of statically typing as a massive assert throughout the program that checks for type consistency before shipping the product. In what world would this be not preferable to dynamically typed systems.

I do agree that polymorphism/dynamic typing is needed at times and makes sense to allow it on as a per-needed basis. By default type checking is a must for any program bigger than a few hundred straight lines of code.

Comment Re:Due to stupid security warnings, security (Score 1) 208

Many dynamically typed languages require you to declare identifiers as variables, but don't require you to declare a static type.

If by "many" you mean a mere handful (e.g. Smalltalk) you would be correct.

Also once you declare a variable is it so hard to declare a type, union of types or a polymorphic type? Does it not help in catch bugs? Dynamically typed languages are an academic solution in search of a problem.

Comment Re:Due to stupid security warnings, security (Score 1) 208

If so, then it shows that do not understand what are the two main objectives of a typed language: (1) this is how the name is spelled and (2) this is the type is supposed to carry.

We declare the name and type so that the compiler/interpreter, can let us know if either one is different later on, because we sure didn't mean that.

Type inference systems can determine if you use types inconsistently and that's about it. It cannot check against the original intent.

Slashdot Top Deals

Eureka! -- Archimedes

Working...