Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 694 695 [696] 697 698 ... 796

Author Topic: if self.isCoder(): post() #Programming Thread  (Read 835088 times)

breadman

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #10425 on: March 13, 2017, 01:47:45 pm »

In this case not paying attention to my types screwed me, but as with any language, the more I practice and reread the documentation the more natural it becomes. Explicit typing is definitely a big sticking point for beginners, but once overcome it has its advantages. JS can have some pretty sneaky typing bugs if you're not careful, and if you don't do any error handling it won't tell you anything is wrong until you've tied your code into knots.
That's a decent point in favor of static typing, but I still prefer dynamic.  Mainly, I haven't yet worked with a system that has implicit typing where possible, and fast compilation times.  In particular, I enjoy being able to call library functions without including header files for them, and modify library functions without recompiling everything that calls them.  Lack of decent module support has to be C's greatest failing.

To be fair, at least C's type system is more sane than Perl's.
Logged
Quote from: Kevin Wayne, in r.g.r.n
Is a "diety" the being pictured by one of those extremely skinny aboriginal statues?

MagmaMcFry

  • Bay Watcher
  • [EXISTS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #10426 on: March 13, 2017, 03:34:48 pm »

To be fair, at least C's type system is more sane than Perl's.
What's wrong with Perl's type system?
Logged

McTraveller

  • Bay Watcher
  • This text isn't very personal.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #10427 on: March 13, 2017, 07:48:29 pm »

That's a decent point in favor of static typing, but I still prefer dynamic.  Mainly, I haven't yet worked with a system that has implicit typing where possible, and fast compilation times.  In particular, I enjoy being able to call library functions without including header files for them, and modify library functions without recompiling everything that calls them.  Lack of decent module support has to be C's greatest failing.

To be fair, at least C's type system is more sane than Perl's.
The only thing worse than not having module support is having module support.  8)

I have never found the need to include header files or have strict typing to be a hindrance when developing software. The big issues are bad (or nonexistent) documentation - "documenting by example" is a plague that should be purged with fire in my opinion - too many layers of abstraction, and violations of the principle of least astonishment.
Logged

Reelya

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #10428 on: March 13, 2017, 08:39:27 pm »

Also those untyped languages tend to be "just run it to find out if there are errors". And some edge cases in your input data could totally change the type of a variable, so you can't even be sure after testing.

Which is complete shit in terms of robust testing. Strict typing may be a pain sometimes but it allows you to code in a much less trial and error fashion, by ensuring all data ported around adhere to strict types, before you just have to cross your fingers and hope it runs ok.
« Last Edit: March 13, 2017, 08:41:32 pm by Reelya »
Logged

Rose

  • Bay Watcher
  • Resident Elf
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #10429 on: March 13, 2017, 10:17:52 pm »

I have literally never, in all my years of coding, thought to myself "gee, I really wish I could store either a number or a fruit basket in the same variable"
Logged

Reelya

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #10430 on: March 13, 2017, 10:25:22 pm »

Module support, of course, would actually make C++ programs compile a lot slower. Because the whole point of that is that you don't have to include header files, so the compiler is going to need to examine all CPP files for all other CPP files to check whether some definition somewhere is used. So it becomes an O(n2) problem with the number of cpp files that you have.

A language with fast compile times, no typing and no header files is actually sacrificing a lot of runtime performance for developer ease of use. C/C++ are the languages aimed at maximum performance, and will always be needed, at least to implement all the shitty languages :P

Using explicit header files is needed to get the optimized compilation of C++ to happen in a more reasonable time (by minimizing the amount of data each module needs to know about during compilation).
« Last Edit: March 13, 2017, 10:30:44 pm by Reelya »
Logged

Mephisto

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #10431 on: March 13, 2017, 11:30:57 pm »

I have literally never, in all my years of coding, thought to myself "gee, I really wish I could store either a number or a fruit basket in the same variable"

This is not directed at Japa or anyone else in particular, just an observation over years of development.

Is it possible for opponents of dynamic typing to use literally any other argument against it? Why do people feel so strongly about languages with which others make things?
Logged

Bumber

  • Bay Watcher
  • REMOVE KOBOLD
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #10432 on: March 14, 2017, 12:34:45 am »

I have literally never, in all my years of coding, thought to myself "gee, I really wish I could store either a number or a fruit basket in the same variable"
What about as an element in an array?
Logged
Reading his name would trigger it. Thinking of him would trigger it. No other circumstances would trigger it- it was strictly related to the concept of Bill Clinton entering the conscious mind.

THE xTROLL FUR SOCKx RUSE WAS A........... DISTACTION        the carp HAVE the wagon

A wizard has turned you into a wagon. This was inevitable (Y/y)?

Arx

  • Bay Watcher
  • Iron within, iron without.
    • View Profile
    • Art!
Re: if self.isCoder(): post() #Programming Thread
« Reply #10433 on: March 14, 2017, 01:31:58 am »

That's what upcasting (downcasting? I confuse the two all the time) is for.
Logged

I am on Discord as Arx#2415.
Hail to the mind of man! / Fire in the sky
I've been waiting for you / On this day we die.

Reelya

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #10434 on: March 14, 2017, 07:45:50 am »

Dynamically typed arrays add a lot of overhead there, since every time a value is accessed it has to check "what the hell am I looking at", and it has to store type information along with your values. Every. single. access.

With a strongly typed language it just stores the raw data and it can safely assume what things are at runtime, since all of the details were set in stone at compile time. Which means more speed and less memory requirements.

Arx

  • Bay Watcher
  • Iron within, iron without.
    • View Profile
    • Art!
Re: if self.isCoder(): post() #Programming Thread
« Reply #10435 on: March 14, 2017, 08:11:08 am »

Is it possible for opponents of dynamic typing to use literally any other argument against it? Why do people feel so strongly about languages with which others make things?

I thought I should mention in light of my last comment, I like Python and enjoy the ease of coding. I just also don't find static typing restrictive. vOv
Logged

I am on Discord as Arx#2415.
Hail to the mind of man! / Fire in the sky
I've been waiting for you / On this day we die.

McTraveller

  • Bay Watcher
  • This text isn't very personal.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #10436 on: March 14, 2017, 08:30:00 am »

Dynamic typing, I have found, is only a *typing* aid; it reduces the amount of stuff you have to know when you are writing a line of code.  Typing
Code: [Select]
var foo = SomeFunction(); is "easy" because you don't have to know what SomeFunction returns.  But on the flip side - unless you have an IDE telling you, you don't know what SomeFunction returns!.

So I find dynamic typing to be an "understand this code" nightmare.  It's especially true when doing code reviews (on, say, GitHub), because you don't have that IDE help and you have to trust that the author attempted to actually compile the code so the types should be correct.

Also - the ability to use identifiers (variables or functions) before they are declared irritates me - also from a code understanding perspective.
Logged

Reelya

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #10437 on: March 14, 2017, 08:37:10 am »

I'm more worried that sometimes the code will decide to return some completely different type to the one you're normally getting. When the return value is based on external data (e.g. user input) that's also a security risk.

So the main criticisms are that it's slow, it's bulky, it's insecure, and it's fairly random. You have to take extra measures to be sure that the type you're getting is the one you want, e.g. wrapping JavaScript function calls that have to return a number in ParseInt(), which fairly much defeats the purpose of having dynamic types.
« Last Edit: March 14, 2017, 08:40:53 am by Reelya »
Logged

McTraveller

  • Bay Watcher
  • This text isn't very personal.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #10438 on: March 14, 2017, 08:43:19 am »

I'm more worried that sometimes the code will decide to return some completely different type to the one you're normally getting. When the return value is based on external data (e.g. user input) that's also a security risk.

So the main criticisms are that it's slow, it's bulky, it's insecure, and it's fairly random. You have to take extra measures to be sure that the type you're getting is the one you want, e.g. wrapping JavaScript function calls that have to return a number in ParseInt(), which fairly much defeats the purpose of having dynamic types.
All the "Indeed!"
Logged

Parsely

  • Bay Watcher
    • View Profile
    • My games!
Re: if self.isCoder(): post() #Programming Thread
« Reply #10439 on: March 14, 2017, 11:13:38 am »

Is it possible for opponents of dynamic typing to use literally any other argument against it? Why do people feel so strongly about languages with which others make things?
I like Python and enjoy the ease of coding. I just also don't find static typing restrictive. vOv
Same. There was a time when I hated static typing but more than a year after my first experience with Java I find myself enjoying it just as much as JS.
Logged
Pages: 1 ... 694 695 [696] 697 698 ... 796