Re: Style geekcode
by rob_au (Abbot) on Mar 25, 2002 at 12:09 UTC
|
A couple of things that stood out with this geek stylecode ... Hrmmm, geek and style, is that a contradiction of terms in itself? ... Anyhow ...
- The ++ denotation within the whitespace around operators seems without merit - This is because while the prefix and postfix increment operands perform the same task, their order differs and as such, depending on the code, are not stylistically interchangeable.
- The == denotation within the whitespace around operators is duplicated by the gt denotation because in fact, after all, == is just another equality test.
- The variable and sub names denotation is quite neat, although I think the parentheses for plurality is redundant if px would suffice (where x is the descriptor code to apply to scalars, hashes and arrays) - For example, Vp(s0h0a0) should be able to be reduced to Vp0.
Very nifty though ... Juerd++
I4 Os1 ;0 S,><.><+>**<=><&&><and><gt> B1
L1 C2 P2 N< R1 Vc1a2p(s0h0a0)r0d2 Hsw2T sub-main | [reply] [d/l] [select] |
|
Hrmmm, geek and style, is that a contradiction of terms in itself?
I like to think so ;)
* The ++ denotation within the whitespace around operators seems without merit
I knew I had to document it better (will do). It's just the difference between $foo++ and $foo ++ - choose any direction ;)
# The == denotation within the whitespace around operators is duplicated by the gt denotation because in fact, after all, == is just another equality test.
I separated them because I have seen someone consequently use "$foo > $bar" and "$foo==$bar"
* For example, Vp(s0h0a0) should be able to be reduced to Vp0.
Perhaps, but that would make the rules very complex, and I think that if someone's going to parse, a simple regex will have to be able to do the job ;)
U28geW91IGNhbiBhbGwgcm90MTMgY
W5kIHBhY2soKS4gQnV0IGRvIHlvdS
ByZWNvZ25pc2UgQmFzZTY0IHdoZW4
geW91IHNlZSBpdD8gIC0tIEp1ZXJk
| [reply] |
Re: Style geekcode
by demerphq (Chancellor) on Mar 25, 2002 at 14:21 UTC
|
It(=4c<!>)Os1;0S,>.+**<=><&&><and><gt>++<==>B1L1
C2P-0.5N>eR2Vc1a1p(s0h0a0)r1.5d0Hsw1sub-main-tidy
Update:
more compliant with the updated spec. I stand by the tidy bit though.
It=4! Os1 ;0 S,>.+**<=><&&><and><gt>++<==> B1 L1 C2
P-.5 N>e R2 Vl(en)c1a1p(s0h0a0)r1d.5 Hsw1 sub-main-tidy
BTW, two thoughts regarding perltidy, the first is that you might have a look there for even more options for a later version of the perl geek style code, and on the other hand wouldnt it be cool if you could feed this style blcok into perltidy and have it behave accordingly? Now theres a nifty little hack that you could do that would put your style code a touch above some of the other codes (at least in terms of practicality.)
Cheers Juerd, good post!
Yves / DeMerphq
---
Writing a good benchmark isnt as easy as it might look. | [reply] [d/l] [select] |
|
(heh you knew that was coming didnt you?)
I was afraid of that, yes :)
* For the indenting im using It(=4c<!>) to mean that I use tabs, but have them set to be displayed as four spaces and that my editor automatically converts leading spaces to such tabs and it automatically truncates trailing spaces.
I'll use just It=4!, meaning: "Indenting by tabs, but they are displayed as 4 columns of nothingness. I have my editor force (exclamation mark was stolen from vim) existing code to follow my style (convert spaces to tabs, in this case)". :)
# Sorry if I didnt follow the code, hopefully you havent finished your parser for this yet ;-)
I don't like parsing/parsed geek codes, so I will leave that up to someone else.
# For parens im using -0.5 because I use the minimum number of parens that keeps my codes meaning clear, but I dont try to explicitly avoid them.
# For references I used R1.5 because I often call vars "array_ref" or the like, but I dont put "ref" in anything like all variables references.
Unlike with ++++ and ---, you can have floating point numbers. I like that idea. Will add :)
* I added the keyword "tidy" to your end block, because I rotuinely run my code through perltidy.
The end stuff was only to indicate order in a file, not programming order.
It(=4c<!>)Os1;0S,>.+**<=><&&<and><gt>++<==>B1L1
C2P-0.5N>eR2Vc1a1p(s0h0a0)r1.5d0Hsw1sub-main-tidy
Hmm, I really meant that whitespace to be in between items. But even that is a matter of style ;) Maybe sub-main is going to screw some parsers, but seeing your code, I'm glad I picked uppercased letters just before hitting submit :)
and on the other hand wouldnt it be cool if you could feed this style blcok into perltidy and have it behave accordingly?
That's just SICK, but a nice idea :)
Cheers jured, good post!
Thanks, but please s/jured/Juerd/ ;)
U28geW91IGNhbiBhbGwgcm90MTMgY
W5kIHBhY2soKS4gQnV0IGRvIHlvdS
ByZWNvZ25pc2UgQmFzZTY0IHdoZW4
geW91IHNlZSBpdD8gIC0tIEp1ZXJk
| [reply] |
|
| [reply] |
Re: Style geekcode
by nefertari (Chaplain) on Mar 25, 2002 at 12:10 UTC
|
I4 Os1 ;0 S,>.<?+?>**=<&&><and>++<gt><==> B1
L1 C1 P0 N> R1 Vl(de,en)c1a1p(s-1h0a0)r0d1 Hsw2 sub-main
It seems to me, that my style is currently changing.
And some of it is due to emacs's indenting system.
To the arraynaming: I often included liste (german for
list) in my arraynames (and my variable names are
often german).
So why not another option:
l at variables with the language code after that for
the naming. For me it would be Vlde.
update: Included l(de,en) in my code.
(Yes, sometimes i use english names) | [reply] [d/l] [select] |
|
So why not another option: l at variables with the language code after that for the naming. For me it would be Vlde.
Great idea, but for the ease of reading I'll make parens required for that: Vl(en,nl) meaning "english most, dutch sometimes"
U28geW91IGNhbiBhbGwgcm90MTMgY
W5kIHBhY2soKS4gQnV0IGRvIHlvdS
ByZWNvZ25pc2UgQmFzZTY0IHdoZW4
geW91IHNlZSBpdD8gIC0tIEp1ZXJk
| [reply] |
Re: Style geekcode (80 columns?)
by Russ (Deacon) on Mar 25, 2002 at 18:00 UTC
|
Oh, too much fun!
Question: how would I show that one rule (see below) trumps all other considerations? For example, my code fits in 80 columns. Always. No exceptions. Period.
So, could you add an item for column width? Perhaps:
80 - Width/Wrapping
How do you handle lines of more than 80 characters?
- 80! - There are no lines longer than 80 characters!
- 80? - Who knows? Just resize your window to see more.
- 80> - My editor can scroll, you luddite!
- 80+ - They wrap, just like you'd expect, what else?
Multiple punctuation marks show your vehemence:
- 80!!!! - Never, Never, Never > 80!
- 80!+ - Usually within 80 columns, but I don't mind some wrapping.
- 80!> - Usually within 80 columns, but just scroll to see the rest, sheesh.
- 80??? - Why would anyone even care about an archaic standard when you have a modern Emacs?
Then, how would I show that the 80 column rule trumps anything else (spaces may disappear to make it fit)?
juerd++
Russ
Brainbench 'Most Valuable Professional' for Perl | [reply] |
Re: Style geekcode
by buckaduck (Chaplain) on Mar 25, 2002 at 13:58 UTC
|
Looking at the codes submitted already, I'm nervously hoping that there are other weirdos like me out there... But here goes:
I2t! Os1 ;0 S,><.><+><**><=><&&><and>++<gt><==> B1
L1 C1 P0 N< R1 Vc1a1p(s-1h0a1)r1d1 Hsw2 main-sub
Update: Well as long as we're all being picky, it's
a shame that I can't specify NO spaces around an operator.
That's why I'm leaving out the ++ operator unless this gets clarified some more. Also, I'm choosing "dummy" variables
even though these are more typically "temp".
buckaduck | [reply] [d/l] |
|
S,><.><+><**><=><&&><and>++<gt><==>
I'll add a bit of clarification to the root node
U28geW91IGNhbiBhbGwgcm90MTMgY
W5kIHBhY2soKS4gQnV0IGRvIHlvdS
ByZWNvZ25pc2UgQmFzZTY0IHdoZW4
geW91IHNlZSBpdD8gIC0tIEp1ZXJk
| [reply] [d/l] |
|
In your example, how do you distinguish between these?
++ <gt>
++< gt>
Update: Apparently he does it by reading the specs more carefully than I did. My bad.
buckaduck | [reply] [d/l] |
|
Re: Style geekcode
by Caillte (Friar) on Mar 25, 2002 at 17:51 UTC
|
Fun idea! Here's mine:
It=8 Os1 ;0 S,><.><+>**<=><&&&
gt;<and>++<gt><==>
B2 L1 C2 P-1 N> Vl(en)c1a1p(s0h0a0)r0d2 Hswl main-sub
This page is intentionally left justified.
| [reply] |
Re: Style geekcode
by buckaduck (Chaplain) on Mar 25, 2002 at 17:35 UTC
|
How about quoting strings:
- in a hash subscript
- left of the comma-like arrow
buckaduck | [reply] |
Re: Style geekcode
by BazB (Priest) on Mar 25, 2002 at 20:44 UTC
|
Probably a little wierd :)
It=4 Os1 ;0 S,>.<+><**><=><&&><and>++<gt><==> B2 L1 C2
P2 N>e R1 Vl(en)c1a1p(s-1a1h1)r2d2 Hsw1a sub-{main}
In english:
- Tab is 4 spaces
- Spaces and newlines all over the shop, but not excessively so!
- Cuddly elses.
- Perl-y variables.
- Use strict warnings and diagnostics or die - although Diagnostics only during development
- Thanks to tye, main is a sub, tho' not for small scripts (less than 200-ish lines)
| [reply] [d/l] |
Re: Style geekcode
by mdillon (Priest) on Mar 25, 2002 at 20:43 UTC
|
It On ;0 S,>.<+><**><=><&&><and>++><gt><==> B0 L1
C0 P-1 N< R1 Vc1a1p(s0h0a1)r0d1 Hsw2 main-sub
| [reply] [d/l] |
Re: Style geekcode
by Amoe (Friar) on Mar 25, 2002 at 21:36 UTC
|
The only blatant thing I can see is in the P bit. What if you avoid parens where it makes the code look prettier or more logical? I don't avoid them with a vehemence, but I do care about them. For example, I always parenthesize remotely complicated things, and sub calls with more than one argument. Anyway, here's mine. I think it's not too odd.
It=4 Os1 ;0 S,><.><+><**><=><&&><and>++<gt><==> B1 L1 C2 P0 N>e R2
Vl(en)c1a1p(s0h0a1)r0d2 Hsw1 main-sub
--
my one true love | [reply] [d/l] |
Re: Style geekcode
by premchai21 (Curate) on Mar 25, 2002 at 21:02 UTC
|
<person>
<uniq><name>Drake Wilson</name><name>premchai21</name></uniq>
<ccode type="perlstylecode">
I4t! On ;02S,>.<+><**><=>&&<and>++<gt>== B0 L1 C0 P0 N>e R1
Vl(en)c3a12p0(ha)r0d0 Hsw1 main-sub|{main}-sub|main
</ccode>
</person>
Gripe: some items should be more "officially" multi-choosable; for instance, see the last item in my code. Also, floating-point numbers are not the best way to go about doing combinations I think; what about "somewhere between 1 and 3"? And, for instance, 1.5 tends to be read as biased towards 1. | [reply] [d/l] |
|
| [reply] |
Re: Style geekcode
by BrentDax (Hermit) on Mar 26, 2002 at 10:15 UTC
|
| [reply] [d/l] |
Re: Style geekcode
by tmiklas (Hermit) on Mar 26, 2002 at 09:59 UTC
|
I4t1 Os1 ;0 S,><.><+>**<=><&&><and>++<gt><==> B1 L1 C2
P1 N>e R-1 Vc1a1p(s-1h1a1)r0d2 Hsw2 sub-main
Greetz, Tom. | [reply] [d/l] |
Re: Style geekcode
by theguvnor (Chaplain) on Apr 14, 2002 at 17:15 UTC
|
This thing probably has too much momentum to change now, but I think it's regrettable that '>' and '<' were chosen to denote anything, since they have to be encoded in order to show up properly in webspace.
Of course, perhaps that's part of the fun ; )
..Jon
| [reply] |
Re: Style geekcode
by snafu (Chaplain) on Apr 15, 2002 at 21:19 UTC
|
This is really great. Here's mine.
It=4 Os1 ;0 S,><.><+><**><=><&&><and>++><gt><==> B2
L2 C2>0 P1 Ne R0 V1enc1>3a1p(s1h1a1)r0d1 Hsw2d?a main-sub
_
_
_
_
_
_
_
_
_
_
- Jim
Insert clever comment here... | [reply] [d/l] |