Re: hangover from perl...
by exussum0 (Vicar) on Apr 27, 2004 at 14:50 UTC
|
I have a good story for you. At least a funny one. I'm very multilingual in terms of programming languages. I know perl, c, some c++, java, etc...
While at a php gig, I would use perl style comments. This isn't bad. php inherited perl's/shell's commenting style as well as c's. Anyway, I had a line I wnated to comment, and used the pound/number sign: #. Things worked fine.
They pushed a release out with my new code, and everything started breaking left and right. Ugly sight. Eventually, the "CTO" of the company went out into production and looked at my code. "What is this?!" Pointing at my humble pound symbol. "It's a comment." A whole bruhaha was started about how comments are not allowed in production code and what not. First I had heard of the rule. THey traced it back to a process that would strip out comments and extra spaces, 'cause php would be "that much faster without extra characters"..
Consequentally, out of 20 or so developers, none of them ever heard of using # symbols for comments in php. :\
| [reply] |
|
I have been a basic/foxpro programmer for several years and i do this in perl once in a while
if ($var eq "hello") then
...
...
...
}
instead of
if ($var eq "hello") {
...
...
...
}
| [reply] [d/l] [select] |
|
You know, that seems more like a story about reasons not to work for that compony then a story about pitfalls of speaking too many languages.
The CTO going into production? Not allowing comments in production? Production code being mangled, instead of being as close as possible to what was being tested? Using PHP?
| [reply] |
|
It was a small company.. but you are right. The CTO had too much involvement. He loved to micromanage. They also didn't believe in not having a QA process, that developers should get things "done right".
| [reply] |
|
| [reply] |
|
php, like perl, in it's more bare form, skip the caching stuff or mod_perl, needs to compile scripts as they are called, no?
With php at this company, the theory was (update not mine :P), less chars, the better for the parser. Don't ask me why and how valid the argument is for such a minute thing.
| [reply] |
|
|
|
| [reply] [d/l] |
|
| [reply] |
|
You are entitled to your opinion as I am to mine.
| [reply] |
Re: hangover from perl...
by blue_cowdawg (Monsignor) on Apr 27, 2004 at 14:14 UTC
|
I not only write code in Perl but in C, C++ and JavaScript
and can so fully relate. Not as bad is when I write stuff
in assembler. At least when I'm coding in assembler I go
into "assembler mode" and don't mix so badly.
Actually, back in the day when I was coding in both Z80
and MC6800x0 assembler I used to mix syntaxes. This
normally occured during one of those all-night sessions
we all know and love. When sleep deprivation takes over
and caffiene just doesn't cut it any more.
Many is the time when I am writing C code I have wanted
to do string operations like:
buffer1 .= buffer2;
or
buffer =~ s/\s+$//;
or some other Perlism. Or this in Perl code:
for(ix=0;ix<=5;ix++) {
:
:
Where are the dollar signs?
Can you spot the C code syntax errors here:
for(ix=0;ix<=$#buffer;ix++){
$buffer[$ix]='\0';
}
Just did that one last week at about 1AM.
| [reply] [d/l] [select] |
|
You could overload the $ and .= symbols.. :)
| [reply] |
|
#define BEGIN {
#define END }
of course that can be made much more complex once our macros start taking parameters! :)
| [reply] [d/l] |
Re: hangover from perl...
by hardburn (Abbot) on Apr 27, 2004 at 14:03 UTC
|
This is quite common for people who have to use more than one language at a time (at least, it is for me). The other day I was making a short C program and the compiler got mad at me for leaving the parens off function calls.
----
: () { :|:& };:
Note: All code is untested, unless otherwise stated
| [reply] [d/l] |
Re: hangover from perl...
by dragonchild (Archbishop) on Apr 27, 2004 at 14:12 UTC
|
| [reply] |
|
dragonchild ponders getting three hats in wildly differing colors, each with the appropriate language written on it.
Go for it, and post pictures! (And tell me where I can buy some!)
My code doesn't have bugs, it just develops random features.
Flame
| [reply] |
Re: hangover from perl...
by Jenda (Abbot) on Apr 27, 2004 at 18:58 UTC
|
The most common Perlism I do in other languages (VB, C#, JavaScript, SQL) is do_something if condition;
I usualy do not finish this and write the condition where the language forces it to be, but I do start by the statement very often.
Jenda
Always code as if the guy who ends up maintaining your code
will be a violent psychopath who knows where you live.
-- Rick Osborne
Edit by castaway: Closed small tag in signature | [reply] [d/l] |
Re: hangover from perl...
by flyingmoose (Priest) on Apr 27, 2004 at 18:39 UTC
|
I missed aliased foreach and map in java ... and a regex engine of better quality than the crappy one provided in 1.4
I don't know when the last time I dollar-signed a variable erroneously, but I know I do things in C++ like try to use the . operator or use a post-statement conditional.
I think the matter is compounded in languages of similar syntax, how everything is typically C-ish. I doubt I'd ever screw up Lisp or Brain**** for instance :)
| [reply] |
Re: hangover from perl...
by CloneArmyCommander (Friar) on Apr 27, 2004 at 17:23 UTC
|
Hahaha :). I find myself doing that a lot, but what I keep wanting to do is declare variables and arrays with $ and @ :). Luckily it hasn't done me any harm, yet :), since JavScript accepts it :). | [reply] |