Free Republic
Browse · Search
General/Chat
Topics · Post Article

To: dan1123
I think you're confusing strong typing with static typing.

Not completely. I was blending bits of strong, static and safe. But for example:

a = 20
b = 1
c = a + b

What will the result be? An int? A byte? A float? Python doesn't care, it's all an int, or a float if there's a decimal point. It will only catch egregious errors as you mentioned. I'm not a Python expert, so correct me if I'm wrong.

As far as dynamic typing, it's also bad for beginners. It lets them play too fast and loose. Thus we get a lot of code jockeys who don't really know how to program.

This looseness is also what I hate about Visual Basic and most other scriptable languages. Sure it lets you prototype faster, but there's a lot more to programming than the prototype. This is my main complaint in my recent foray into Objective C. I like the strong, static, safe, nominal typing of c#. But then I'm a control freak when it comes to programming.

59 posted on 07/07/2009 11:47:31 AM PDT by antiRepublicrat
[ Post Reply | Private Reply | To 53 | View Replies ]


To: antiRepublicrat
What will the result be? An int? A byte? A float?

Python can tell you

>>> a = 20
>>> b = 1
>>> c = a + b
>>> type(c)
<type 'int'>

Python doesn't care, it's all an int, or a float if there's a decimal point.

No decimal point required:

>>> a = float(2)
>>> type(a)
<type 'float'>
>>> print a
2.0

This looseness is also what I hate about Visual Basic and most other scriptable languages. Sure it lets you prototype faster, but there's a lot more to programming than the prototype. This is my main complaint in my recent foray into Objective C. I like the strong, static, safe, nominal typing of c#. But then I'm a control freak when it comes to programming.

But you're okay with this behavior?

main() {
	char a[] = "When in the Course of human events "
		"it becomes necessary for one people to "
		"dissolve the political bands which have "
		"connected them with another";
	char b, *c;
	b = 'a';
	c = a + b;
	printf("%s\n", c);
}

# gcc test.c
# ./a.out
bands which have connected them with another

69 posted on 07/07/2009 3:32:44 PM PDT by dan1123 (Liberals sell it as "speech which is hateful" but it's really "speech I hate".)
[ Post Reply | Private Reply | To 59 | View Replies ]

To: antiRepublicrat
I like the strong, static, safe, nominal typing of c#.

Just so you know, C# has duck typing.

70 posted on 07/07/2009 3:42:22 PM PDT by dan1123 (Liberals sell it as "speech which is hateful" but it's really "speech I hate".)
[ Post Reply | Private Reply | To 59 | View Replies ]

Free Republic
Browse · Search
General/Chat
Topics · Post Article


FreeRepublic, LLC, PO BOX 9771, FRESNO, CA 93794
FreeRepublic.com is powered by software copyright 2000-2008 John Robinson