Dollar sign ($) on foriegn keyboards? (prothon)

M

Mark Hahn

We are considering switching to the dollar sign ($) for self, instead of the
period ( . ) we are using now in Prothon. Ruby uses the at-sign (@) for
self, but our new usage of self also includes replacing the period for some
attribute references, as in obj$func() versus obj.func(), and too many
programs treat that as an email address and screw it up. Also the S in the
symbol $ reminds one of the S in $elf.

Can people from outside the U.S. tell me if typing the dollar sign often
would be a problem in writing code? Is it available and somewhat easy to
type on international keyboards?
 
R

Roel Schroeven

Mark said:
Can people from outside the U.S. tell me if typing the dollar sign often
would be a problem in writing code? Is it available and somewhat easy to
type on international keyboards?

Belgian azerty: no problem. Easier to type, in fact, than several other
symbols that are frequently used while programming, e.g. []{}_.
 
L

LB

"
Can people from outside the U.S. tell me if typing the dollar sign often
would be a problem in writing code? Is it available and somewhat easy to
type on international keyboards?
$ is a shift-key on italian standard keyboard.

LB
 
?

=?ISO-8859-1?Q?Petter_Holmstr=F6m?=

Mark said:
Can people from outside the U.S. tell me if typing the dollar sign often
would be a problem in writing code? Is it available and somewhat easy to
type on international keyboards?

Finnish/Swedish keyboards: No problems (AltGr + 4)

-Petter-
 
P

Peter Otten

Mark said:
We are considering switching to the dollar sign ($) for self, instead of
the
period ( . ) we are using now in Prothon. Ruby uses the at-sign (@) for
self, but our new usage of self also includes replacing the period for
some attribute references, as in obj$func() versus obj.func(), and too
many
programs treat that as an email address and screw it up. Also the S in
the symbol $ reminds one of the S in $elf.

Can people from outside the U.S. tell me if typing the dollar sign often
would be a problem in writing code? Is it available and somewhat easy to
type on international keyboards?

In Germany every serious programmer has to switch to the American layout
anyway because of {}[]@\~| (all odd AltGr combinations). As this is no
problem on Windows and Linux(KDE) (how about the Mac?), I recommend against
making special character choices based on keyboard layout.

Apart from that obj$func() hurts my eye more than obj->func() and
obj!func(). As always, Python shines here with its obj.func() :)

Peter
 
J

Joe Mason

Apart from that obj$func() hurts my eye more than obj->func() and
obj!func(). As always, Python shines here with its obj.func() :)

I believe the suggestion is "$.func()" instead of "self.func()" (the
Python way) or just ".func()" (the earlier Prothon way). Or possibly
the suggestion is for "$func()", although I like $.func() much better.

(I like this better than the ., though I still have no problem with
writing self all the time, so I prefer sticking to the Python way. It
solves my main problem with ., which is when you do have to pass self
explicitly. "function_call(param1, ., parm2)" is much more confusing
than "function_call(param1, $, param2)".)

Joe
 
H

Hugh Macdonald

Can people from outside the U.S. tell me if typing the dollar sign
often would be a problem in writing code? Is it available and
somewhat easy to type on international

Anyone who writes a language like Perl or PHP would use it a lot anyway (all variables start with a symbol, usually $)
 
P

Peter Otten

Joe said:
I believe the suggestion is "$.func()" instead of "self.func()" (the
Python way) or just ".func()" (the earlier Prothon way). Or possibly
the suggestion is for "$func()", although I like $.func() much better.

I skimmed too lightly over the first paragraph and missed that - but still
there is the obj$func() example in Mark's post, and with my Python mindset
(I didn't follow the Prothon discussion closely) I cannot figure out what
that is supposed to mean.
(I like this better than the ., though I still have no problem with
writing self all the time, so I prefer sticking to the Python way. It
solves my main problem with ., which is when you do have to pass self
explicitly. "function_call(param1, ., parm2)" is much more confusing
than "function_call(param1, $, param2)".)

[OT] Seems to happen all the time with Python - try to simplify at some
point and you pay twice elsewhere. Prothon will have a hard time occupying
a local optimum in beauty/simplicity/usefulness that is both near and
better than Python. This starts with the name, by the way - it evokes the
association of prothotype, which looks quite, er, ungreek :)

Peter
 
S

srijit

Hello Mark,
IMO typing dollar($) sign should not be a problem in Sweden and Germany.

Regards,
Srijit
 
A

Adriano Varoli Piazza

El Mar 20 Abr 2004 03:22, Mark Hahn escribió:
We are considering switching to the dollar sign ($) for self, instead
of the period ( . ) we are using now in Prothon. Ruby uses the
at-sign (@) for self, but our new usage of self also includes
replacing the period for some attribute references, as in obj$func()
versus obj.func(), and too many programs treat that as an email
address and screw it up. Also the S in the symbol $ reminds one of
the S in $elf.

Can people from outside the U.S. tell me if typing the dollar sign
often would be a problem in writing code? Is it available and
somewhat easy to type on international keyboards?

Spanish and Latin American QUERTY keyboards: Shift + 4.
--
Adriano Varoli Piazza
The Inside Out: http://moranar.com.ar
ICQ: 4410132
MSN: (e-mail address removed)
Claves gpg / pgp en hkp://subkeys.pgp.net
 
P

Peter Maas

Peter said:
In Germany every serious programmer has to switch to the American
> layout anyway because of {}[]@\~| (all odd AltGr combinations).

Oh, I didn't know that. Fortunately I'm not a serious programmer. ;)

Mit freundlichen Gruessen,

Peter Maas
 
P

Peter Otten

Peter said:
Peter said:
In Germany every serious programmer has to switch to the American
layout anyway because of {}[]@\~| (all odd AltGr combinations).

Oh, I didn't know that. Fortunately I'm not a serious programmer. ;)

I hate people being apodictic - even myself.
But I never felt comfortable with AltGr, so it was a great relief when I
learned about switching kezboard lazouts and well worth the occasional y-z
glitch. By the way, I once came across a whole book that had these
characters swapped.

Maybe my fingers just didn't grow in the right place to press AltGr+9
simultaneously, but somehow I can't see how that makes me the member of a
minority.

Mit freundlichen Gr[-en :)

Peter
 
F

Fredrik Lundh

Mark Hahn wrote:¨
We are considering switching to the dollar sign ($) for self, instead of the
period ( . ) we are using now in Prothon.

any reason you cannot set up a mailing list for your little pet
project? you're generating tons of off-topic traffic, and frankly,
I don't think I'm the only one who couldn't care less about your
pre-alpha hack with minimum capabilities.

(if I posted hundreds of messages for every pre-alpha hack I've
ever made, people would quickly label me as an annoying crack-
pot.)

</F>
 
D

Des Small

Mark Hahn said:
Can people from outside the U.S. tell me if typing the dollar sign often
would be a problem in writing code? Is it available and somewhat easy to
type on international keyboards?

The dollar sign is used in extensively in Unix shells and Perl, which
are both widely used (Perl also on Windows). It seems unlikely that
any keyboard with a latin alphabet wouldn't include it.

Des
types in a wide variety of dollar-equipped iso encodings.
 
J

Joe Mason

I skimmed too lightly over the first paragraph and missed that - but still
there is the obj$func() example in Mark's post, and with my Python mindset
(I didn't follow the Prothon discussion closely) I cannot figure out what
that is supposed to mean.

Oops - I skimmed even more lightly than you did, cause I missed the
obj$func example entirely.

Joe
 
J

Joe Mason

Mark Hahn wrote:¨


any reason you cannot set up a mailing list for your little pet
project? you're generating tons of off-topic traffic, and frankly,
I don't think I'm the only one who couldn't care less about your
pre-alpha hack with minimum capabilities.

There is a mailing list, it's got tons of traffic, and I think Mark's
being pretty judicious in what he posts here.

Joe
 
M

Mark Hahn

Fredrik Lundh said:
any reason you cannot set up a mailing list for your little pet
project? you're generating tons of off-topic traffic, and frankly,
I don't think I'm the only one who couldn't care less about your
pre-alpha hack with minimum capabilities.

(if I posted hundreds of messages for every pre-alpha hack I've
ever made, people would quickly label me as an annoying crack-
pot.)

Sorry if I annoy, but I've only posted a total of about 4 thread-starting
messages. The hundreds of messages have been replies.

We do have active Prothon mailing lists, but no international members yet,
which is why I asked this particular question here.

When I posted my first Prothon messages, I asked if I should stay away from
c.l.p. out of courtesy. I was specifically told to hang around here by
several of the top Pythoneers, because they view Prothon as a potential
learning ground, or sandbox, for Python. So I will do so until those same
top Pythoneers tell me I have worn out my welcome, thank you very much.
 
M

Mark Hahn

I guess I should outline my whole proposal for $ in Prothon. I'll try to be
brief.

Statement of problem:

# in python

class klass:
def __init__(self):
self.me = 1
def func(self):
print "func1,self"+str(self.me),

class klass2(klass):
def __init__(self):
self.me = 2
def func(self):
klass.func(self)
print "func2,self"+str(self.me),

inst = klass2()
inst.func() # prints func1,self2 func2,self2

#in Prothon

Klass = Object()
with Klass:
.me = 0
def .__init__():
.me = 1
def .func():
print "func1,self"+.me,

Klass2 = Klass()
with Klass2:
def .__init__():
.me = 2
def .func():
Klass.func() # does not do what python does
print "func2,self"+.me,

inst = Klass2()
inst.func() # prints func1,self0 func2,self2

As you can see, the call Klass.func() got the function func from the object
Klass and then called it on Klass using Klass as the target "self" instead
of the instance "inst". In Python the call klass.func was different because
Python knows that klass is a class and therefore obviously cannot be the
target of call (an instance), so it made the programmer pass the instance to
use as a parameter (something Prothon never does).

To fix this, we have to make things more explicit in Prothon. This is a
GOOD thing, making things more explicit. It makes things simpler. We have
four different proposals over on the Prothon mailing lists right now. I'll
show mine here right now briefly by just showing a bunch of sample code
lines:

$.var # $ replaces Python's self (think $elf)
$var # same thing (. is optional after $ self symbol)
obj.func() # get func from obj and bind to obj during call
obj$func() # get func from obj and bind to self during call
x = obj.func # get func from obj (simple attr retrieval)
bm = obj..func # get func from obj and make bound method from obj and func
bm = obj$$func # get func from obj and make bound method from self and func
with bobj: cobj$func() # get func from cobj and bind to bobj during call
with bobj: bm = cobj$$func # get func from cobj and make bound method from
bobj

Now we can fix the problem stated above using the example in the fourth line
above ( obj$func() ):

Klass = Object()
with Klass:
.me = 0
def .__init__():
.me = 1
def .func():
print "func1,self"+.me,

Klass2 = Klass()
with Klass2:
def .__init__():
.me = 2
def .func():
Klass$func() # ambiguity fixed
print "func2,self"+.me,

inst = Klass2()
inst.func() # prints func1,self2 func2,self2
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,189
Members
46,734
Latest member
manin

Latest Threads

Top