Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^2: Small Perl 6 discoveries IV, hash access

by Anonymous Monk
on Oct 05, 2017 at 19:19 UTC ( #1200762=note: print w/replies, xml ) Need Help??


in reply to Re: Small Perl 6 discoveries IV, hash access
in thread [Perl6] Perl 6 discoveries IV, hash access

On a related note, what's a good editor for typing weird unicode characters that perl6 likes, such as double angle brackets ?
  • Comment on Re^2: Small Perl 6 discoveries IV, hash access

Replies are listed 'Best First'.
Re^3: Small Perl 6 discoveries IV, hash access
by afoken (Canon) on Oct 05, 2017 at 20:49 UTC
    On a related note, what's a good editor

    Well, of course emacs and vi! ;-)

    for typing weird unicode characters that perl6 likes, such as double angle brackets ?

    Probably the same as you use now. The double angle brackets are part of ISO-8859-1 and its supersets ISO-8859-15, and Windows-1252 (at positions 0xAB and 0xBB), ISO-8859-9 (at the same positions), ISO-8859-13 (also at 0xAB and 0xBB), and ISO-8859-16 (again at the same positions). Mac Roman has them at 0xC7 and 0xC8.

    It's not so much an editor problem, but a keyboard layout problem.

    The commonly used keyboard layouts don't even have mappings for all symbols in the ISO-8859-x series. Keyboard layouts were designed for people writing texts in one or a few local languages, on mechanical typewriters. Computer keyboards have largely copied those layouts. See https://en.wikipedia.org/wiki/Keyboard_layout for the big picture, and the keyboard layouts shown in https://de.wikipedia.org/wiki/Tastaturbelegung for a lot of European layouts.

    Look at the classic US layout. It is good for ASCII, but nothing more. The UK layout has some french accented characters due to the french influences in old times. The extended variant adds some more.

    The standard German layout used in Germany and Austria has umlauts (), the sharp s (), and dead keys for writing French and some other accented languages. But it lacks a key kombination for and , also used in French. There are two extended variants (T2 and T3) that are rarely used and practically not available printed or engraved in key caps. T2 is suitable for all latin-based official languages of europe, T3 adds support for minority languages.

    Guess which layout is used in Switzerland. Right, they have their own layout, optimized for typing German, French, Italian and Romansh on a single keyboard. And you won't find the sharp s () on that keyboard, because Swiss german does not use it.

    Hop through a few more layouts (QWERTZ, AZERTY, QWERTY) and you will see a mess of mappings. Layouts for a larger set of language, e.g. US-International are available, and even actually used (e.g. in the Netherlands). BTW: The US-International keyboard allows typing the double angle brackets.

    But 10 Fingers and "only" about 100 keys make it hard to enter all of Unicode. Unicode currently (v10.0) has 139 scripts using 136755 characters, and there is still room for more. So even in future, keyboard layouts will suck if you need to type "exotic" characters. Perhaps even more than today.

    People keep inventing new keyboard layouts, optimized for something, making them hardly useable for something else. There is no best keyboard layout for everything, like there is no best editor for everything.

    Many people prefer coding using the US or the US-International keyboard, simply because most popular programming languages were designed to use the US keyboard.


    There is a solution from the early days of C, using trigraphs instead of characters not available on all platforms and keyboards: http://codingfox.com/4-5-trigraph-characters-in-c-language/

    Trigraph SequenceEqual character
    ??=#
    ??([
    ??)]
    ??/\
    ??<{
    ??>}
    ??!|
    ??^
    ??-~

    This makes hello world look a little bit funny, but it is still readable:

    ??=include <stdio.h> int main() ??< printf("Hello??/nWorld"); return 0; ??>
    #include <stdio.h> int main() { printf("Hello\nWorld"); return 0; }

    I would expect that Perl6 has a similar feature to express "uncommon" Unicode characters by using replacement ASCII sequences. And of course, a little bit of searching ends at Unicode versus ASCII symbols.

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
Re^3: Small Perl 6 discoveries IV, hash access
by Your Mother (Archbishop) on Oct 05, 2017 at 19:53 UTC

    Has more to do with the OS/keyboard support. Most modern editors support whatever you can get out of your keyboard. If you have a Mac, the keyboard shortcuts are intuitive and trivial to learn; as is switching language support on the keyboard. PCs are a bit of hoop for all that but they are there or available for installation. Don't know about Linux keyboard support personally.

      Don't know about Linux keyboard support

      Linux supports any keyboard mapping you like, only limited by the hardware, as one would expect. The KBD Linux keyboard tools are used to set up the keyboard mapping for the console. See the man pages if you want to know more.

      X11 is a different beast, it has its own, different mapping mechanism. Of course, you can use your own keyboard mapping. For Xorg, there are a few a good articles in the archlinux wiki (Xorg, XKB, extra keys). Desktop environments like Gnome, KDE, xfce can also influence the keyboard mapping, using the mechanisms embedded in the X11 system.

      Alexander

      --
      Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
      If you have a Mac, the keyboard shortcuts are intuitive and trivial to learn
      Oh, cool, so is option-shift-backslash. Obvious!

        The typographically correct quote characters are all arranged in those three adjacent and (mostly) balanced keys, []{}\|, easy to follow after you see it once as opposed to Alt+#### which is idiotic, anti-UX nonsense along with needing to install support for additional languages. And many of the shortcuts are so obvious one doesn't even have to experiment or memorize it, like ¢ being Option+4 ($) or a • being Option+8(*).

Re^3: Small Perl 6 discoveries IV, hash access
by Laurent_R (Canon) on Oct 07, 2017 at 20:27 UTC
    On a related note, what's a good editor for typing weird unicode characters that perl6 likes, such as double angle brackets ?
    Unless I missed it, nobody so far has provided link to the following documentation, which, I think, brings at least some partial answers to your question: https://docs.perl6.org/language/unicode_entry.
      That's very helpful. I have to point out that there is no default binding for normal-width 「corner quotes」 (U+FF62 and U+FF63) in vim, although 「double-width」 ones (U+300C and U+300D) are available. Also, the vim documentation page (vimdoc.sourceforge.net/htmldoc/digraph.html) is served with no encoding specified, so you might have to manually set the encoding to read it properly. That's pretty hilarious.
Re^3: Small Perl 6 discoveries IV, hash access
by holli (Abbot) on Oct 08, 2017 at 22:50 UTC
    You can use whatever snippet plugin is available for your editor.


    holli

    You can lead your users to water, but alas, you cannot drown them.
      I'm not sure what a "snippet plugin" is, but I assume you're telling me to set up my own ad-hoc unicode entry system. Um... thanks. I'm sure that won't become unmanageable.
        No, I am telling you to use the capabilities of whatever editor you use. Atom for example has support for snippets built in. For others there editor plugins. With little or more effort (depending) you can set up snippets that give you unicode operators.

        I use a snippet file for Atom that lets me, for example, type Inf(SHIFT-TAB) and i get the infinity symbol in my editor.


        holli

        You can lead your users to water, but alas, you cannot drown them.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1200762]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2021-05-06 22:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Perl 7 will be out ...





    Results (80 votes). Check out past polls.

    Notices?