Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

'self' and 'this'

Name: Mature Related !K/L9IJgMJY 2010-06-09 22:49

Whats your opinion on "self" or "this" in the programming languages. I think it is retarted.

you always see people doing stuff like this (in psudeo-py):

class blah
     def bloo(self, x, y)
          self.x = x
          self.y = y
               pass

when it could be:

class blah
     def bloo (x, y)
         pass


picture unrelated; this is a text board.

Name: Anonymous 2010-06-09 22:52

I'm not going to say anything, but I can already anticipate the {expert go back to /rightful place/} replies.

Name: Anonymous 2010-06-09 22:59

retarted

I don't see any issues with the practice.

Name: Anonymous 2010-06-09 23:00

Whats ... retarted ... psudeo
y ... w ... p
In addition to this, you did not use [code] tags, and with a tiny bit more effort your posted code could have been genuine Python.
Finally, your question is a poor one: it doesn't apply to all languages, so you should be specifying which languages you want to discuss; and if you meant FIOC, specifically, the code you posted shows that you don't actually understand the issue.

In conclusion, {expert1 back to wherever, please.}


1 Traditionally, expert is defined as b.i.o.u, whereas the back to /α/ (for some α) usually uses m.o.u or m.i.o.u, so interpret this expression as you will.

Name: Anonymous 2010-06-09 23:16

OP, do you actually have a point or are you just an idiot? Wait a minute... let's see

tripcode
email (fake, no doubt)
picture unrelated; this is a text board.  <- imageboard quality
can't spell
singles out a `problem` and proceeds to only provide half a solution

Yep, back to /g/, please

Name: Anonymous 2010-06-09 23:18

>>4
b.i.o.u

Whereas this ordering is debatable, it doesn't matter as, with a tiny bit more effort, you could have used valid SexpCode to express this:

{define expert m.i.o.u}{expert back to wherever, please.}{define expert b.i.o.u}

Name: Anonymous 2010-06-09 23:23

>>1
I have no problem with this.  Python has reasonable justification for using self like they do, though I also admit to not always accepting it without a grumble; besides, you only have to perform this silly trick when you def a method.

Name: Anonymous 2010-06-09 23:30

>>6
b.i.o.u is the ordering used by Xarn.

Name: Mature Related !K/L9IJgMJY 2010-06-09 23:50

>>3
>>7

the is issue is having it everywhere is redundant.

Though I would settle on this:

class blah
     def bloo (x, y)   <--- notice the lack of self argument
          self.x = x
          self.y = y
                pass


or some add some lua-ness:
     

       Blah.Bloo (self, x,y)     <---- notice the period
       
is the same as:

       Blah:Bloo (x, y)      <---- notice the colon



>>5
ofcourse it is real.

Name: Anonymous 2010-06-09 23:52

>>9
You don't understand what that self is in Python.
And for fuck's sake, if you can't even remember Python's syntax, at least fucking look it up before complaining about it.

Name: Anonymous 2010-06-09 23:53

>>9
Firstly, why do you have the pass? It is superfluous, which is pretty stupid considering your position.
Two, while I too disagree with explicit self, how does your proposal effect monkey patching?
Thirdly, why did you generalise to include `this` and others, when not all languages follow the python model?

Name: Anonymous 2010-06-09 23:58

>>11
The answer to all of your questions is ``because he's an idiot who doesn't know what he's talking about''.

Name: Anonymous 2010-06-09 23:58

>>8

No, it's a ordering used by Sarn

Name: Anonymous 2010-06-10 0:08

>>12
Actually, it only answers 1 and 3. Although, the answer to 2, namely "it fucks it up unless python decides to go the ruby route which won't happen", is a corollary

Name: Anonymous 2010-06-10 0:13

>>11
I included 'this,' because its the samething. in a language that can use indentation to derive scope, making self implied would be easy.

I've never made a Monkey Patch so I can't comment,

Name: Anonymous 2010-06-10 0:28

>>15
Not every language obeys the same scoping rules as python. Most, as far as I am aware, allow you to specify privately scoped variables for the class and it's instance. Secondly, python does not use indentation to derive scope. (denote may be a more accurate term, but that's still wrong). Scope in python is semi-dynamic.

Name: Anonymous 2010-06-10 0:32

What is wrong with Sepples's this keyword?

Name: Anonymous 2010-06-10 0:47

>>17
It's a Sepples keyword.

Name: Anonymous 2010-06-10 0:47

Scope in python is semi-dynamic.
Now that I think about it, that's a misleading way of putting it. It's not at all dynamic in that you don't look for bindings in the call stack. Mutable scope? fuck it, who cares

Name: Anonymous 2010-06-10 0:53

>>19
I'd just call it "seriously fucked up scope" and leave it at that.

Name: Anonymous 2010-06-10 0:57

>>17
the rest of sepples that comes with it.

Name: Anonymous 2010-06-10 1:17

Name: Anonymous 2010-06-10 1:23

Name: Anonymous 2010-06-10 1:24

In Java, using the keyword 'this' is actually resmarted because it lets the internal variable and its parameter be named the same thing. This is great if you use an IDE like Eclipse where you can mouse over the function and read the parameters.

Name: HIBT? 2010-06-10 1:26

>>24
resmarted

Name: Anonymous 2010-06-10 1:41

>>1 your retarded

Name: Anonymous 2010-06-10 6:37

>>24
Writing a codes and using a mouse, eh?

Name: Anonymous 2010-06-10 10:19

>>24
He uses an IDE!
If you don't take advantage of every available super on top of the this as far as object variables are concerned, you just aren't trying terribly hard to be efficient.

Name: YHABT 2010-06-10 10:33

Name: Anonymous 2010-06-10 10:34

>>27
Actually with a decent laptop you can use the touchpad (or nipple-mouse) without taking either hand off the keyboard.

And if you take a day or two getting used to a touchpad they're quite convenient. I can point, click, drag, and even scroll in all four directions while keeping both hands on home row, just by reaching my thumbs downward slightly.

Name: Anonymous 2010-06-10 10:52

>>1
This is the first time I saw a retard using this keyword for a class/instance method, srsly.

Name: Anonymous 2010-06-10 18:47

>>27

Keyboards are useless for programming. All you need is :
- a mouse
- A ching-chong character input system
- A ching-chong programming langage (bro-tip : RUBY)

Name: Anonymous 2010-06-10 19:06

A ching-chong character input system
No thanks, mobile phones are useless for programming

Name: Anonymous 2010-12-17 1:22

Are you GAY?
Are you a NIGGER?
Are you a GAY NIGGER?

If you answered "Yes" to all of the above questions, then GNAA (GAY NIGGER ASSOCIATION OF AMERICA) might be exactly what you've been looking for!

Name: Anonymous 2011-02-04 12:33

Don't change these.
Name: Email:
Entire Thread Thread List