The Ur-Quan Masters Home Page Welcome, Guest. Please login or register.
Did you miss your activation email?
December 03, 2022, 04:41:49 pm
Home Help Search Login Register
News: Celebrating 30 years of Star Control 2 - The Ur-Quan Masters

+  The Ur-Quan Masters Discussion Forum
|-+  The Ur-Quan Masters Re-Release
| |-+  Starbase Café (Moderator: Death 999)
| | |-+  Re: Static vs. Dynamic typing
« previous next »
Pages: [1] Print
Author Topic: Re: Static vs. Dynamic typing  (Read 3478 times)
onpon4
Enlightened
*****
Offline Offline

Gender: Male
Posts: 709


Sharing is good.


View Profile WWW
Re: Static vs. Dynamic typing
« on: June 14, 2011, 03:53:36 am »

static typing (a big plus)

I don't know what planet you're coming from, but I don't see how static typing is a "big plus". Dynamic typing may not always catch errors early on, but it makes a language much more flexible. One fairly small example is the ability to use the special value None in Python, rather than resorting to values like -1, since a variable can be any type instead of being restricted to, say, integers. This can actually be extremely useful in certain situations.
Logged

chiguireitor
Zebranky food
*
Offline Offline

Posts: 10



View Profile
Re: Static vs. Dynamic typing
« Reply #1 on: June 14, 2011, 04:51:13 am »

Hehehe was thinking on bringing python to the fray too (if you take a peek, you'll see that uqmonline is hosted on a Google App Engine "server" which uses python)... but don't want a flame war to start Cheesy There's two kinds of programmers: the ones that love static typing and the ones that love dynamic/duck typing.

Being a simultaneous programmer on both kind of languages (i use DAILY Object Oriented Pascal, Perl, Python, Javascript and Java) i really like the expressiveness and flexibility of dynamic/duck typing and the functional power of those languages (loved Prolog and Ocaml when i used them on the university).

Things like monkey patching are great and add a lot of value to dynamic languages. However, all these dynamic languages cannot exist without their static brethen and most of those fancy interpreters are coded in one of those less flexible languages, keep that in mind always.

Quick Edit: Didn't know that here in this forum were python coders Smiley good to know
« Last Edit: June 14, 2011, 04:52:53 am by chiguireitor » Logged
Megagun
Enlightened
*****
Offline Offline

Gender: Male
Posts: 580


Moo


View Profile
Re: Static vs. Dynamic typing
« Reply #2 on: June 14, 2011, 05:30:42 pm »

static typing (a big plus)

I don't know what planet you're coming from, but I don't see how static typing is a "big plus". Dynamic typing may not always catch errors early on, but it makes a language much more flexible. One fairly small example is the ability to use the special value None in Python, rather than resorting to values like -1, since a variable can be any type instead of being restricted to, say, integers. This can actually be extremely useful in certain situations.
If you think that that is a big advantage of dynamic typing, you haven't worked with statically typed languages enough. Smiley
Here's a bit of code that does what you want, plus some more, written in Java (a statically typed language):
Code:
int i = 0; //primitive data types such as int can't be null
Integer j = null; //Integers can be null
Object oj = j;
Integer joj = (Integer) oj; //cast Object to Integer

The real advantage of dynamically typed languages is that the language syntax can be a lot smaller, and more advanced features can be implemented way easier. Java code tends to be rather extremely verbose, yet Python code is small and elegant. This can be annoying though when you have to read someone else's code. Have fun digging through code to find out what a variable named 'foo' contains! Furthermore, dynamically typed languages allow you to extend existing code with extra features without a lot of pain.

The major advantage of statically typed languages is that stuff will be checked for you at compile-time, which will save you a lot of pain if you're developing an application to launch nuclear missiles at hostile forces. Furthermore, IDEs tend to be a lot nicer for statically typed languages, as they're far more capable of figuring out what exactly that variable named 'foo' contains without running your application and figuring it out that way (bad idea), doing expensive code analysis, or making the user specify it manually in a comment-annotation.
« Last Edit: June 14, 2011, 05:57:19 pm by Megagun » Logged
chiguireitor
Zebranky food
*
Offline Offline

Posts: 10



View Profile
Re: Static vs. Dynamic typing
« Reply #3 on: June 14, 2011, 11:17:21 pm »

Now we can flame each other correctly here hahahahaha  Grin

Thanks meep-eep
Logged
Lukipela
Enlightened
*****
Offline Offline

Gender: Male
Posts: 3620


The Ancient One


View Profile
Re: Static vs. Dynamic typing
« Reply #4 on: June 16, 2011, 10:51:44 pm »

I prefer semi-static myself, where the dynamicity can be regulated by the integer stack.
Logged

What's up doc?
Zeep-Eeep
Enlightened
*****
Offline Offline

Gender: Male
Posts: 917


Good Grief


View Profile WWW
Re: Static vs. Dynamic typing
« Reply #5 on: September 10, 2011, 03:47:13 pm »

I use a bit of both and I don't think there's a particular advantage of one or the other. That being said.... I find it easier to read other people's code in static-typing languages. Every so often one runs into a coder who likes to just throw in variables and make them do whatever is convenient at the time. That gets frustrating. It's bad enough if variable "abc" is used for different purposes, it gets worse is "abc" is a string at one point and a number later.
Logged

What sound does a penguin make?
Pages: [1] Print 
« previous next »
Jump to:  


Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!