Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

(tye)Re: My day with Damian Conway

by tye (Sage)
on Jun 26, 2001 at 09:11 UTC ( [id://91518]=note: print w/replies, xml ) Need Help??


in reply to My day with Damian Conway

print << "END"; Here's the text of the message I want to print. Note that I'm not flush left like I would have to be in Perl 5. The amount of whitespace before the terminating "END" is stripped from the front of each line. END
So how many spaces are there in a tab? I guess we'll also have to have a new Perl 6 pragma: use tabstop 4;

(:

        - tye (but my friends call me "Tye")

Replies are listed 'Best First'.
Re: (tye)Re: My day with Damian Conway
by Vynce (Friar) on Jul 02, 2001 at 16:43 UTC

    that's actually addressed (vaguely) in apocalypse 2, but if you think about it, it is unlikely to matter, as long as you are consistent. meaning, if you indent your text "\t\t" and your HERE "\t\t" then they are the same no matter what tabstop is.

    if you care about perl6, the apocalypses are worth reading.

      By default, if it has to dwim, it should dwim assuming that hard tabs are 8 spaces wide. This should not generally pose a problem, since most of the time the tabbing will be consistent throughout anyway, and no dwimming will be necessary. This puts the onus on people using nonstandard tabs to make sure they're consistent so that Perl doesn't have to guess.

      Larry seems to be making a few assumptions that I find invalid. First, that "tabs are 8 spaces" is the most common setup. I actually find (to my amazement and disdain) that "tabs are 4 spaces" is the most common situation with lots of other variants flying about.

      Second, that people aren't illogically, passionately opposed to moving to that standard when given a push. I find that some people are just that. Part of the problem is that some editing tools don't make it easy to indent your code "4 spaces at a time" unless you also have tabs set at 4 spaces each so forcing people to move to 8 spaces per tab also makes editing their code more difficult.

      Third, that normal editing activities usually leave the "tabbedness" of lines similar. I work at a company where the policy is that tabs be converted to spaces before you check in your code so that we don't have to agree on how many spaces are in a tab (because we tried to agree and it was hopeless). I've seen how most of the developers edit code and it is trivial to set their environment so that tabs get turned to spaces. However, my editor shows me tabs and I can say that the tabbedness of related lines is very often not similar even though the lines look similarly indented to the people working on them. So if company policy in a small company can't make that happen, I have no hope for Perl 6 policy making that happen in the huge Perl community.

      For example, most editors auto-indent lines in at least some situations. My editor defaults to using tabs for that but doesn't (by default) convert typed spaces to tabs. Other editors at work default to using spaces for auto-indent and don't convert typed tabs.

      So I consider that use tabstop will be a required feature but the change will still result in a spate of confusion and adjustment. Don't get me wrong, the change is probably worth all of that, but it is a shame to not see better forethought on the matter.

              - tye (but my friends call me "Tye")
        I agree with you, tye
        tab is a key which behavior apes a mechanical device. It should generate the appropriate number of spaces. It should not have been a character in the first place because its interpretation vary with editors. Consideration of disk space or bandwidth are more and more irrelevant partly due to the existence of good compression schemes.

        Hopefully, emacs has a untabify function that converts tabs to spaces and the buffer local variable indent-tabs-mode must be set to generate spaces on tab press.

        -- stefp

      Bad assumption.

      If I edit code, I tend to indent with spaces. Some editors automatically insert tabs. So I am dealing with code that behind the scenes has tabs, I edit normally, and now the code breaks with no visible mistake? Please let us not go there...

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (3)
As of 2024-03-29 01:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found