Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 373 374 [375] 376 377 ... 796

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

GlyphGryph

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5610 on: March 20, 2014, 02:50:46 pm »

Eh, symbols (as in non-alphanumeric characters) are fine as long as their meanings are clear and they're not overused so as to retain readability. Case in point: Brainfuck.
He mentioned Ruby symbols though, and symbols in ruby ARE alphanumeric. >_>
Logged

MorleyDev

  • Bay Watcher
  • "It is not enough for it to just work."
    • View Profile
    • MorleyDev
Re: if self.isCoder(): post() #Programming Thread
« Reply #5611 on: March 20, 2014, 03:12:06 pm »

As always, XKCD has a comic for this discussion:


But yeah, it can often feel like some programming languages just use symbols to look smarter than they are. Can get a bit annoying when a language uses symbols that aren't well established notations, and that well established notations already exist. Like, why does Scala need infix operators AND a concatenate operator?
« Last Edit: March 20, 2014, 05:52:46 pm by MorleyDev »
Logged

GlyphGryph

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5612 on: March 20, 2014, 03:20:57 pm »

Wait, can someone clarify exactly what ruby symbols we're talking about here? >_> Please?
Logged

MagmaMcFry

  • Bay Watcher
  • [EXISTS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5613 on: March 20, 2014, 04:56:26 pm »

My antipathy for symbols in code is pretty high.
*menacingly waves Perl at you*
Logged

SolarShado

  • Bay Watcher
  • Psi-Blade => Your Back
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5614 on: March 20, 2014, 05:13:24 pm »

My antipathy for symbols in code is pretty high.
*menacingly waves Perl at you*
*pulls out a/the swiss army knife of regular expressions*
Logged
Avid (rabid?) Linux user. Preferred flavor: Arch

alexandertnt

  • Bay Watcher
  • (map 'list (lambda (post) (+ post awesome)) posts)
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5615 on: March 20, 2014, 10:33:48 pm »

There seems to be a positive coorelation between precieved language/library quality and use of symbols (independent of how useful or necessary the symbols are in the first place). And as such I will from now on code everything in APL.
Logged
This is when I imagine the hilarity which may happen if certain things are glichy. Such as targeting your own body parts to eat.

You eat your own head
YOU HAVE BEEN STRUCK DOWN!

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #5616 on: March 20, 2014, 11:35:25 pm »

d3 is pretty awesome. So flexible and simple.
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

Mego

  • Bay Watcher
  • [PREFSTRING:MADNESS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5617 on: March 21, 2014, 01:32:10 am »

C++ symbol gotchas:

:: is namespace resolution and static class member resolution
* is multiplication, pointer declaration, and pointer dereferencing
& is bitwise AND, lvalue-reference declaration, and pointer referencing
&& is boolean AND and rvalue-reference declaration
>> is bitwise rshift and stream extraction
<< is bitwise lshift and stream insertion

I'm sure there are more gotchas, but it's late and I'm tired.

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #5618 on: March 21, 2014, 04:50:01 am »

You should construct a super-convoluted symbol example for C++ that mixes up all those usages.
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

LoSboccacc

  • Bay Watcher
  • Σὺν Ἀθηνᾷ καὶ χεῖρα κίνει
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5619 on: March 21, 2014, 08:30:00 am »

and in c++ everything could be a method, even []
class bad {
        value_type& operator[](index_type idx);
}
Logged

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #5620 on: March 21, 2014, 08:32:53 am »

Why is that bad? That's actually probably the most useful case for operator[]...
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

LoSboccacc

  • Bay Watcher
  • Σὺν Ἀθηνᾷ καὶ χεῖρα κίνει
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5621 on: March 21, 2014, 08:43:48 am »

dunno.
I never found a use for a class that also wanted to be an array which couldn't be made more easily and in a safer manner using a plain container (arrays, standard lists, whatever) 
or a wrapper class over a standard container

edit: probably because I am biased to see array more as memory structure than as data structure so having behaviour behind [] makes me uneasy
« Last Edit: March 21, 2014, 08:48:55 am by LoSboccacc »
Logged

GlyphGryph

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5622 on: March 21, 2014, 09:24:00 am »

Whereas in Ruby, [] really IS just a method!

As is + and - and all the other things that would be "operators" in another language - just more methods in Ruby.

Redefining one of those in someones project when they aren't looking is quite fun, heheheh.

But seriously, I still don't understand the people who think ruby has a lot of symbols. Why won't someone explain it to me... T_T
Logged

MorleyDev

  • Bay Watcher
  • "It is not enough for it to just work."
    • View Profile
    • MorleyDev
Re: if self.isCoder(): post() #Programming Thread
« Reply #5623 on: March 21, 2014, 09:26:27 am »

Of course, standard containers such as vectors use operator[] to abstract away their implementation details which could (doesn't but could) just be a wrapper around a pointer which gets addressed via []. And you should be using vector by default for dynamically sized sets. list is a specialisation and vector is typically more efficient in most situations the cache misses of a list dwarf the reallocation costs of vector. Source: Bjarne Stroustrup.

C++ gives you the tools to shoot yourself in the foot, the tools to protect yourself from shooting yourself in the foot, and trusts you to know to use the latter unless you need the former. Greatest strength and greatest weakness of the language. Sure, you have naked pointers. But you also have RAII constructs such as unique_ptr and shared_ptr which use those naked pointers so you don't have to. Sure you have operator overloading, but we trust you not to overload the + operator to return the nth fibonnaci sequence multiplied by pi and divided by the result of a network request to random.org.

Of course I do dislike the hijacking of byteshifting to mean streaming, I can kinda see the logic but still dislike it and would argue it is an abuse of operator overloading. And the use of * and & to also mean pointer/reference is a bit unpleasant.
« Last Edit: March 21, 2014, 09:29:25 am by MorleyDev »
Logged

LoSboccacc

  • Bay Watcher
  • Σὺν Ἀθηνᾷ καὶ χεῖρα κίνει
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5624 on: March 21, 2014, 09:28:26 am »

true, and you can do awesome thing, but you have to consider 50% of the programmers workforce is composed by below average programmers, and 99% of our methodologies and languages are focused on making those guys productive.
Logged
Pages: 1 ... 373 374 [375] 376 377 ... 796