Harish,

I [shall carefully reply to] you because I had
[searched my mail and found] that you were a serious
man, to be treated with respect. But I must say no to
you and let me give you my reasons. It's true I have a
lot of friends in [software], but they wouldn't be so
friendly if they knew my business was [pontificating]
instead of [flaming] which they consider a harmless
vice. But [pontification], that's a dirty business.

On Wed, Nov 11, 2009 at 7:49 PM, Harish Mallipeddi
<harish.mallipe...@gmail.com> wrote:
> Going by the popular definition of weak/strong typing, what has weak typing
> in C/C++ anything to do with buffer overflow errors? Javascript is weakly
> typed but you don't have buffer overflow problems there.
>

Hmm... this is going to get tricky, since everyone
seems to have different opinions on what these terms
mean.  I'm very confused about JavaScript.  Why do you
say it's weakly typed?

I did a quick web search on this, and most people seem
to agree with you, based on the fact that in
JavaScript:

>>> "hello" + 10
"hello10"
>>> 10 + "hello"
"10hello"

So everything can be, uh, "promoted" to a String.  But
can I, say, take an Object and treat it as a number?
Or an Array as a String?  Or is JavaScript weak in
certain directions and strong in others?

Maybe you should let on what you mean by strong/weak
typing.

What I meant by saying that weak typing in C/C++ causes
buffer overruns is that everything is just a memory
location, since you can arbitrarily switch between
pointers and types, which means that you can't have
sanity checks for array accesses (which are your buffer
overruns) without changing the language itself.

> I would assume that people are arguing for strong typing for
>> efficiency.  A language with run time dynamic dispatch, like say
>> Python, will always be slower than something which is statically
>> typed.
>>
>>
> Again why would strong typing get you efficiency?
>

Am I comparing apples and potatoes, if I am please do
let me know.  I say that run time dynamic dispatch is
slow because you always need to look things up,
specially in python since you can arbitrarily change
anything at runtime, on the other hand, if you have a
strongly typed language (thanks for catching that) then
you know at compile time what you want your code to do,
hence you don't have to find that out at runtime, time
saved doing that makes your language faster all other
things being equal.

I could be horribly wrong, I don't know enough about
programming languages to be sure.  So please do let me
know if you think so.

How about this, lets make it less controversial and
bring the talk back to safer ground: the best Python
code will always be slower than high quality C++ code
no matter how good the Python optimizers get.  Speed
might not be always important and yada-yada-yada,
that's irrelevant to the last statement. I write more
Python than C++, so yeah, I've heard of most of those
reasons.

Roshan
_______________________________________________
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers

Reply via email to