Alternative to ~= for inequality?

classic Classic list List threaded Threaded
95 messages Options
12345
Reply | Threaded
Open this post in threaded view
|

Alternative to ~= for inequality?

colinz
Is there a way to use !=, /= or <> as an alternative to ~= ?
I am asking because the keyboard I am currently using does not have the
tilde key.
Thanks

Reply | Threaded
Open this post in threaded view
|

RE: Alternative to ~= for inequality?

原林

> Is there a way to use !=, /= or <> as an alternative to ~= ?
> I am asking because the keyboard I am currently using does not have the
> tilde key.
> Thanks
>
I think the only way to do is to change the source code of the function llex in llex.c to recognize your substitution as TK_NE.
Reply | Threaded
Open this post in threaded view
|

Re: Alternative to ~= for inequality?

Michal Kolodziejczyk-3
In reply to this post by colinz
On 07.02.2013 08:00, [hidden email] wrote:
> Is there a way to use !=, /= or <> as an alternative to ~= ?

Only not (a==b) as far as I know.

> I am asking because the keyboard I am currently using does not have the
> tilde key.

But you can probably easily map one of the existing key/combinations so
you will get your tilde.

Regards,
        miko



Reply | Threaded
Open this post in threaded view
|

Re: Alternative to ~= for inequality?

Robert Virding
In reply to this post by colinz
You have probably tried this but:

On swedish keyboards ~ is a diacritical mark which is applied the the character coming afterwards. So to get a ~ you need to press ~ then SPACE. It takes a bit of getting used to. Swedish keyboards are the most practical for programming.

Robert

----- Original Message -----

> From: [hidden email]
> To: [hidden email]
> Sent: Thursday, 7 February, 2013 8:00:51 AM
> Subject: Alternative to ~= for inequality?
>
> Is there a way to use !=, /= or <> as an alternative to ~= ?
> I am asking because the keyboard I am currently using does not have
> the
> tilde key.
> Thanks

Reply | Threaded
Open this post in threaded view
|

Re: Alternative to ~= for inequality?

Javier Guerra Giraldez
On Thu, Feb 7, 2013 at 2:57 PM, Robert Virding
<[hidden email]> wrote:
> Swedish keyboards are the most practical for programming.

can you elaborate?  if true, then you're really lucky because i _hate_
local (latin american) keyboards.  that means i have to mailorder my
laptop... :-(

it's kinda hard to believe any layout can be better than the one most
languages are developed on.

--
Javier

Reply | Threaded
Open this post in threaded view
|

Re: Alternative to ~= for inequality?

Robert Virding
Whoops that was a typo, it should have read:

Swedish keyboards are NOT the most practical for programming.

Or perhaps me being sarcastic in an overly subtle way. :-)

Robert

----- Original Message -----

> From: "Javier Guerra Giraldez" <[hidden email]>
> To: "Lua mailing list" <[hidden email]>
> Sent: Thursday, 7 February, 2013 9:20:50 PM
> Subject: Re: Alternative to ~= for inequality?
>
> On Thu, Feb 7, 2013 at 2:57 PM, Robert Virding
> <[hidden email]> wrote:
> > Swedish keyboards are the most practical for programming.
>
> can you elaborate?  if true, then you're really lucky because i
> _hate_
> local (latin american) keyboards.  that means i have to mailorder my
> laptop... :-(
>
> it's kinda hard to believe any layout can be better than the one most
> languages are developed on.
>
> --
> Javier
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Alternative to ~= for inequality?

sergei karhof
In reply to this post by Robert Virding
On Thu, Feb 7, 2013 at 8:57 PM, Robert Virding

>So to get a ~ you need to press ~ then SPACE. It takes a bit of getting used to.

Not just that. The problem is that some keyboards do not have the ~ key at all.

It would be helpful if Lua users were allowed to use at least != as an
alternative. Remapping the keyboard is always possible, but it's an
unwanted complication, which may turn out to be problematic with other
programs on your system. Likewise, modifying the Lua source files and
recompiling the lot is a cumbersome solution, which may also lead to
other problems.

I wonder how many of us would prefer to have != instead of ~=. Probably many.

Appeal to Lua developers: is there any chance of at least adding != as
an alternative in the next release?

Reply | Threaded
Open this post in threaded view
|

Re: Alternative to ~= for inequality?

Alexandre Rion
In reply to this post by colinz

If I am not wrong:
ALT + 126 => ~

----- Reply message -----
From: "sergei karhof" <[hidden email]>
To: "Lua mailing list" <[hidden email]>
Subject: Alternative to ~= for inequality?
Date: Fri, Feb 8, 2013 14:27




On Thu, Feb 7, 2013 at 8:57 PM, Robert Virding

>So to get a ~ you need to press ~ then SPACE. It takes a bit of getting used to.

Not just that. The problem is that some keyboards do not have the ~ key at all.

It would be helpful if Lua users were allowed to use at least != as an
alternative. Remapping the keyboard is always possible, but it's an
unwanted complication, which may turn out to be problematic with other
programs on your system. Likewise, modifying the Lua source files and
recompiling the lot is a cumbersome solution, which may also lead to
other problems.

I wonder how many of us would prefer to have != instead of ~=. Probably many.

Appeal to Lua developers: is there any chance of at least adding != as
an alternative in the next release?

Reply | Threaded
Open this post in threaded view
|

Re: Alternative to ~= for inequality?

Alexandre Rion
In reply to this post by colinz

If I am not wrong:
ALT + 126 => ~

----- Reply message -----
From: "sergei karhof" <[hidden email]>
To: "Lua mailing list" <[hidden email]>
Subject: Alternative to ~= for inequality?
Date: Fri, Feb 8, 2013 14:27




On Thu, Feb 7, 2013 at 8:57 PM, Robert Virding

>So to get a ~ you need to press ~ then SPACE. It takes a bit of getting used to.

Not just that. The problem is that some keyboards do not have the ~ key at all.

It would be helpful if Lua users were allowed to use at least != as an
alternative. Remapping the keyboard is always possible, but it's an
unwanted complication, which may turn out to be problematic with other
programs on your system. Likewise, modifying the Lua source files and
recompiling the lot is a cumbersome solution, which may also lead to
other problems.

I wonder how many of us would prefer to have != instead of ~=. Probably many.

Appeal to Lua developers: is there any chance of at least adding != as
an alternative in the next release?

Reply | Threaded
Open this post in threaded view
|

Re: Alternative to ~= for inequality?

Alejandro Cámara
In reply to this post by Alexandre Rion
Probably not your case, but in Spanish/Spain keyboards you can obtain the ~ symbol:
  1. Windows: pressing ALTGR+4 and then space.
  2. GNU/Linux: pressing ALTGR+ñ and then space.
Don't ask me why there's not visual aid in the physical keyboard for this because I don't have a clue...

Good luck!
Álex
Reply | Threaded
Open this post in threaded view
|

Re: Alternative to ~= for inequality?

Joseph Manning
In reply to this post by sergei karhof
On 2013-Feb-08 (Fri) at 14:25 (+0100), sergei karhof wrote:

>> I wonder how many of us would prefer to have != instead of ~=.

-1

>> Appeal to Lua developers: is there any chance of at least adding != as
>> an alternative in the next release?

   Nooooooo!  Please don't Perl-ise it.

------------------------------------------------------------------------
Joseph Manning / Computer Science / UCC Cork Ireland / [hidden email]
------------------------------------------------------------------------

Reply | Threaded
Open this post in threaded view
|

Re: Alternative to ~= for inequality?

Alexandre Erwin Ittner
In reply to this post by Alexandre Rion
On Fri, Feb 8, 2013 at 11:38 AM, Alexandre Rion <[hidden email]> wrote:
>
> If I am not wrong:
> ALT + 126 => ~

Also, you can set a macro/etc. in your editor to automatically replace
!= for this when typed.

I simply don't see this as a reason to change the language and add a
lot of incompatibilities. Tildes are used in C and C++ too, despite
being dead-key diacritics in Brazilian, English, and (as I remember)
German keyboards.


--
Alexandre Erwin Ittner - [hidden email]
OpenPGP pubkey 0x0041A1FB @ http://pgp.mit.edu

Reply | Threaded
Open this post in threaded view
|

Re: Alternative to ~= for inequality?

sergei karhof
In reply to this post by Joseph Manning
On Fri, Feb 8, 2013 at 2:50 PM, Joseph Manning <[hidden email]> wrote:
>>> Appeal to Lua developers: is there any chance of at least adding != as
>>> an alternative in the next release?
>
>    Nooooooo!  Please don't Perl-ise it.


Rather than Perl-izing it, I would say: bringing it in line with most
of modern languages.
FWIW, Lua's solitary choice of ~= is a weird quirk.

Reply | Threaded
Open this post in threaded view
|

Re: Alternative to ~= for inequality?

Enrico Colombini
In reply to this post by sergei karhof
On 08/02/2013 14.25, sergei karhof wrote:
> I wonder how many of us would prefer to have != instead of ~=. Probably many.

I don't think there are many Lua-only programmers around; C(++), for
example, has a ~ operator. Besides, in Linux/Unix ~ is the home directory.
Many national keyboards have problems with other symbols too. Typing
braces on an Italian keyboard is not fun, not least because the required
key combination tends to vary depending on the device maker.

As many others, I've solved the problem once and for all by setting the
US layout and typing blindly on whatever keyboard I happen to use.
(well... writing in French requires a lot of Alt-nnn, but for
programming it's perfect)

--
   Enrico

Reply | Threaded
Open this post in threaded view
|

Re: Alternative to ~= for inequality?

Alex Queiroz
In reply to this post by sergei karhof
On Fri, Feb 8, 2013 at 2:58 PM, sergei karhof <[hidden email]> wrote:
>
> Rather than Perl-izing it, I would say: bringing it in line with most
> of modern languages.
> FWIW, Lua's solitary choice of ~= is a weird quirk.
>

Programming language design is not fashion.

--
-alex
http://unendli.ch/

Reply | Threaded
Open this post in threaded view
|

Re: Alternative to ~= for inequality?

Michael Richter
In reply to this post by sergei karhof
On 8 February 2013 21:58, sergei karhof <[hidden email]> wrote:
Rather than Perl-izing it, I would say: bringing it in line with most
of modern languages.
FWIW, Lua's solitary choice of ~= is a weird quirk.

Personally I'd prefer ¬= myself.  Because ! to me means "send message" in a language I use that's far more modern than C or C++ or any of the other curly brace blight languages.

I cannot believe that people are calling syntax from a language created in the '60s (be very careful before trying to challenge me on this date!) "modern".

--
"Perhaps people don't believe this, but throughout all of the discussions of entering China our focus has really been what's best for the Chinese people. It's not been about our revenue or profit or whatnot."
--Sergey Brin, demonstrating the emptiness of the "don't be evil" mantra.
Reply | Threaded
Open this post in threaded view
|

Re: Alternative to ~= for inequality?

Rob Kendrick-2
On Fri, Feb 08, 2013 at 11:52:53PM +0800, Michael Richter wrote:

> On 8 February 2013 21:58, sergei karhof <[hidden email]> wrote:
>
> > Rather than Perl-izing it, I would say: bringing it in line with most
> > of modern languages.
> > FWIW, Lua's solitary choice of ~= is a weird quirk.
> >
>
> Personally I'd prefer ¬= myself.  Because ! to me means "send message" in a
> language I use that's far more modern than C or C++ or any of the other
> curly brace blight languages.

! to me means "pointer dereference" :)  When I first started using Lua,
many many years ago, ~= confused me because it struck me that it should
be "approximately equal".  I managed to get over this within 5 minutes
of using the language, and it confuses me why it might take anybody else
longer.

> I cannot believe that people are calling syntax from a language created in
> the '60s (be *very* careful before trying to challenge me on this date!)
> "modern".

Well, both B and BCPL are from the '60s.  I don't recall if BCPL used !=
but B certainly did.

B.

Reply | Threaded
Open this post in threaded view
|

Re: Alternative to ~= for inequality?

Ross Bencina
In reply to this post by Joseph Manning
On 9/02/2013 12:50 AM, Joseph Manning wrote:
>>> Appeal to Lua developers: is there any chance of at least adding != as
>>> >>an alternative in the next release?
>     Nooooooo!  Please don't Perl-ise it.

"Perl-ise" o.O You gotta be kidding. That's the only language you know
with != ?


For some light relief I thought I'd go through the TIOBE top 20 looking
at inequality operators (info sourced from [2][3] where not otherwise
indicated ):

!=

C, Java, Objective-C, C++, C#, PHP [4], Python [5], Perl [6], JavaScript
[7], Ruby, Bash


<>

Visual Basic, VB.NET [8], Pascal, Delphi/Object Pascal[10], Python
(deep) [5]


~=

Smalltalk, MATLAB, Lua


/=

Lisp [9], Ada


Alex wrote:
 > Programming language design is not fashion.

Notation is not about obscuritansim either.


Cheers,

Ross.


[1] http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html
[2] http://en.wikipedia.org/wiki/Relational_operator
[3] http://rigaux.org/language-study/syntax-across-languages-per-language/

[4] PHP also has !==
http://rigaux.org/language-study/syntax-across-languages-per-language/PHP.html#2
[5] Python also has <> for deep inequality
http://rigaux.org/language-study/syntax-across-languages-per-language/Python.html
[6] Perl 6 also has !==
http://rigaux.org/language-study/syntax-across-languages-per-language/Perl6.html
[7] === and !== differ from == and != when the objects' type differ
http://rigaux.org/language-study/syntax-across-languages-per-language/JavaScript.html#1
[8] http://msdn.microsoft.com/en-us/library/aa711633(v=vs.71).aspx
[9]
http://www.gnu.org/software/emacs/manual/html_node/elisp/Comparison-of-Numbers.html
[10] http://library.thinkquest.org/C006657/delphi/operators_in_delphi.htm

Reply | Threaded
Open this post in threaded view
|

Re: Alternative to ~= for inequality?

Joseph Manning
On 2013-Feb-09 (Sat) at 03:04 (+1100), Ross Bencina wrote:

>>     Nooooooo!  Please don't Perl-ise it.
>
> "Perl-ise" o.O You gotta be kidding. That's the only language you know  
> with != ?

No, sorry, I was not very clear -- many other languages indeed use "!=",
but I was referring to Perl's "there's more than one way to do it" style

------------------------------------------------------------------------
Joseph Manning / Computer Science / UCC Cork Ireland / [hidden email]
------------------------------------------------------------------------

Reply | Threaded
Open this post in threaded view
|

Re: Alternative to ~= for inequality?

William Sumner
In reply to this post by Alex Queiroz
On Feb 8, 2013, at 7:10 AM, Alex Queiroz <[hidden email]> wrote:

> On Fri, Feb 8, 2013 at 2:58 PM, sergei karhof <[hidden email]> wrote:
>>
>> Rather than Perl-izing it, I would say: bringing it in line with most
>> of modern languages.
>> FWIW, Lua's solitary choice of ~= is a weird quirk.
>>
>
> Programming language design is not fashion.

But it is a user interface for developers. If something is confusing, unusual, or difficult to type because it's missing on some keyboards, it's worth some thought.

Preston

12345