Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 172 173 [174] 175 176 ... 796

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

Mego

  • Bay Watcher
  • [PREFSTRING:MADNESS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2595 on: June 25, 2012, 11:20:14 am »

Java's primitive types (int, long, float, double, char, boolean) are value-types, so they copy by value.

Java's objects are reference-types, so they copy by reference.

String pretends to be a primitive and is taught to be a primitive to entrance-level students, but really is not a primitive at all when you examine it closely, like Stargrasper did.

GlyphGryph

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2596 on: June 25, 2012, 11:24:44 am »

So strings are passed by value, then?

Ruby's primitives pass by reference as well, though that's not exactly meaningful since it's not like you can change primitives.
Logged

Mego

  • Bay Watcher
  • [PREFSTRING:MADNESS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2597 on: June 25, 2012, 11:58:34 am »

Nope, Strings are passed by reference, just like all other Java objects. There's a link in the OP to Stargrasper's post, where he did research into Strings and made us all go WTF.

GlyphGryph

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2598 on: June 25, 2012, 12:05:12 pm »

In what ways does it intend to be a primitive then? ::curious::
Logged

Mego

  • Bay Watcher
  • [PREFSTRING:MADNESS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2599 on: June 25, 2012, 12:11:38 pm »

The fact that it appears that a String object can be initialized without the new operator.

Code: [Select]
int a = 5; // initializing a primitive
ArrayList<Object> b = new ArrayList<Object>(); // initializing an object
String c = "foo"; // initializing a String, part 1
String d = new String("bar"); // initializing a String, part 2

However, initializing a String like this is just like copy-constructing any object: it copies the object by reference. "foo" is also a String. In fact, it's an anonymous final String. But, intro-level programming classes/books in Java leave that part out, for convenience's sake.

MorleyDev

  • Bay Watcher
  • "It is not enough for it to just work."
    • View Profile
    • MorleyDev
Re: if self.isCoder(): post() #Programming Thread
« Reply #2600 on: June 25, 2012, 01:01:50 pm »

Yeah, Strings are the kind of things I point at when listening my beefs with Java. That and things which are completely consistent with all the syntax rules Java previously laid out, but are forbidden and made exceptions that cause compile-time errors purely because the way the compiler works can't cope with them unless you do some very specific and ugly casting tricks...

.NET tends to get beef more in implementation and unpredictable overheads (lookup the foreach overhead and weep, for it is essentially up to the whims of the compiler and the gods if it's better to use a for or a foreach in some situations and if you're code is performance critical and that for/foreach is called a lot each frame, it can become an issue).

C++ gets beef for being essentially a 1980s style language being used with 2010s design patterns. It's like the steampunk of programming languages...

Come to think of it, learning to program is 75% learning how to create logically flowing algorithms, 5% learning the rules of the specific languages you're using and 20% learning the stupidities of the specific languages you're using.
« Last Edit: June 25, 2012, 01:14:41 pm by MorleyDev »
Logged

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #2601 on: June 25, 2012, 01:47:41 pm »

I'm trying to get an image handling library (IM) to work, but I don't think I'm linking it correctly. :(

All I did was plop the .hs into the include folder and the .libs into the lib folder.

In Visual Studio 2010 for C++.
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

olemars

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2602 on: June 25, 2012, 02:13:34 pm »

Pasting the error messages is sort of always the key for stuff like this,  but in general for precompiled libs and VS, you need to add the path to the includes to the "additional include directories" under C/C++ options for the project, add the path to the libs to "additional library directories" under linker options, and the name of the actual lib files to linker input.
Logged

GlyphGryph

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2603 on: June 25, 2012, 02:15:28 pm »

Hey, Morley, any languages you don't have a beef with?

Ptyhon, Ruby, C#, Prolog?
Logged

MorleyDev

  • Bay Watcher
  • "It is not enough for it to just work."
    • View Profile
    • MorleyDev
Re: if self.isCoder(): post() #Programming Thread
« Reply #2604 on: June 25, 2012, 02:22:26 pm »

Nope :D No language is perfect, after all. I've found part of programming is figuring out which language sucks the least for the job at hand ^^

Don't get me wrong I enjoy programming, heck in a week I start my year-long paid internship as a software developer programming primarily in C#, but I'll never labour under the delusion any language is without it's flaws and weaknesses. Down that road lies only madness. :)
Logged

GlyphGryph

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2605 on: June 25, 2012, 02:24:45 pm »

Ruby has no flaws and no weaknesses.

* GlyphGryph adopts vacant, zombie-like stare.

No weaknesses... no weaknesses...
Logged

Virex

  • Bay Watcher
  • Subjects interest attracted. Annalyses pending...
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2606 on: June 25, 2012, 02:50:27 pm »

Perfection is not when there's nothing more to add, but when there's nothing more to remove. Ergo, Brainfuck is perfect.
Logged

Mego

  • Bay Watcher
  • [PREFSTRING:MADNESS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2607 on: June 25, 2012, 03:07:38 pm »

Perfection is not when there's nothing more to add, but when there's nothing more to remove. Ergo, Brainfuck is perfect.

This post is perfect.

MagmaMcFry

  • Bay Watcher
  • [EXISTS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2608 on: June 25, 2012, 03:53:37 pm »

Perfection is not when there's nothing more to add, but when there's nothing more to remove. Ergo, Brainfuck is perfect.

This post is perfect.
Nope.
Logged

kaijyuu

  • Bay Watcher
  • Hrm...
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2609 on: June 25, 2012, 04:01:16 pm »

ZZT OOP is still the best programming language evar.
Logged
Quote from: Chesterton
For, in order that men should resist injustice, something more is necessary than that they should think injustice unpleasant. They must think injustice absurd; above all, they must think it startling. They must retain the violence of a virgin astonishment. When the pessimist looks at any infamy, it is to him, after all, only a repetition of the infamy of existence. But the optimist sees injustice as something discordant and unexpected, and it stings him into action.
Pages: 1 ... 172 173 [174] 175 176 ... 796