Re^2: What Perl CAN'T do?
by Perl Mouse (Chaplain) on Dec 14, 2005 at 10:55 UTC
|
perl cannot be written in Perl
If your statement is true, Perl is a less powerful language than say, BASIC or Cobol. See, perl is written in C, a Turing complete language. BASIC, Cobol, and almost any serious language (with the exception of some very domain specific languages) is Turing complete, which means that anything that can be done in one language, can be done in the other.
perl is written in C. Hence, perl can be written in BASIC and Cobol.
Luckely, your statement is false. Perl is a Turing complete language, and hence, perl can be written in Perl.
| [reply] |
|
| [reply] |
|
I shall prove you wrong then. To write perl in Perl all that you need to do is write a C interpreter in Perl. But since there are plenty of working C compilers, all that you really need to do is emulate what a C compiler compiles to. Thus you need to write a virtual machine that implements the assembly language of any chip that will run Perl. Which seems to me like a doable, if useless, project. :-)
| [reply] |
|
|
|
| [reply] |
|
|
| [reply] |
Re^2: What Perl CAN'T do?
by grinder (Bishop) on Dec 14, 2005 at 13:35 UTC
|
perl cannot be written in Perl
Yes it can. There is nothing from stopping you writing a bootstrap parser and eventually creating a self-compiling Perl parser+runtime written in Perl. But, and this is the 2**16 dollar question.... why would you want to do a thing like that?
(For those following along at home who can make no sense of this dialog, the language is Perl, and the interpreter that interprets said language is perl).
One thing I do know... Perl should not be used when speed is of the essence. I'm currently stress testing Regexp::Assemble. I started the run last Friday afternoon on a hexaprocessor box. The run has performed about 147 million combinations as of right now (more than 4.6 billion unit tests), a grand 7% of the problem space...
On the plus side, the run hasn't turned up any bugs.
• another intruder with the mooring in the heart of the Perl
| [reply] |
|
There is nothing from stopping you...
Here are a few things that would hold me back:
- It would be hard to find others who also want to work on such a project (cause, as you say, 'why?')
- With a minuscule team of programmers my development speed will likely be slower than that of the mainstream C perl, therefore I'm writing towards a target that's moving further away all the time.
- Even if I try to write towards a fixed and existing version of perl5 I'll likely not be finished in my lifetime (and if I do nothing but hack on Perlperl all day my lifetime will be even more finite that it is anyway)
You're right, there's nothing in the design of Perl that makes this task impossible in theory, but I'd be willing to bet all the money I own that it is impossible in practice. (Note to prospective punters: it's not very much money :-)
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. -- Brian W. Kernighan
| [reply] |
|
| [reply] |
Re^2: What Perl CAN'T do?
by itub (Priest) on Dec 15, 2005 at 01:34 UTC
|
It depends. Are you allowed to use eval? ;-) | [reply] [d/l] |
Re^2: What Perl CAN'T do?
by Courage (Parson) on Dec 14, 2005 at 17:06 UTC
|
Python could be written on python, but perl can not be written in perl?
I disagree - those are languages with approximately same capabilities and general ideas.
However, your following discussion makes me agree with you on other points, so ++ to you.
Best regards,
Courage, the Cowardly Dog
| [reply] |