Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Perl6: Choosing language version in the shebang line?

by Marshall (Canon)
on Feb 22, 2017 at 08:35 UTC ( [id://1182504]=note: print w/replies, xml ) Need Help??


in reply to Perl6: Choosing language version in the shebang line?

I quote your post:
Languages need to evolve, but when C evolved into different varieties, ultimately, it was called a different language. The same seems to be true of Perl.
No. If you mean that C++ is a "different" language than C, that is wrong. C++ is a superset of C. This backward compatibility required a lot compromises. Ancient C code will compile using a C++ compiler.

update: A new attempt at expressing my thought: The difference between Perl 5 and 6 is much greater than the relative difference between C and C++. The code for my last C project the C code needed to be compatible with 4 compilers, 2 in C and 2 in C++. This is possible when writing new C code; however, an arbitrary existing program may or may not compile with a C++ compiler.

It is true that interfacing C and C++ binaries complied under different compliers can be problematic because at a fundamental level, each language uses a different subroutine calling protocol. In C the calling program manages the assembly lauguage stack. In C++, the callee (the subroutine) manages the assembly lauguage stack.

But this linking difference does not rise to the level of "a different language", at least not at the source code level.

If you like OO, the big difference in Perl over the past years has been better ways of doing it. Perl 5 OO has become much easier than it used to be.

I will leave it to other Monks to talk about Perl 5 OO, Moose, Moo and the tools that have become mainstream Perl 5 OO for users.

If you have older Perl 5 OO code, there is no problem running it together with more modern Perl 5 OO implementations. I suggest you become more informed about Perl 5 advances since you last used Perl in an OO environment.

Perl 6 is a completely different language from Perl 5. This is not at all like C versus C++.

  • Comment on Re: Perl6: Choosing language version in the shebang line?

Replies are listed 'Best First'.
Re^2: Perl6: Choosing language version in the shebang line?
by afoken (Chancellor) on Feb 23, 2017 at 10:43 UTC
    If you mean that C++ is a "different" language than C, that is wrong. C++ is a superset of C. This backward compatibility required a lot compromises. Ancient C code will compile using a C++ compiler.

    Sorry, but while most C code will compile using a C++ compiler, C++ is not a superset of C, and there is code that a C++ compiler won't compile successfully. There are C constructs that a C++ compiler will refuse; and extensions of newer C standards (like C99) are not available in a C++ compiler. Also, some constructs behave differently in C and C++.

    There is a long article in the Wikipeda explaining the Compatibility of C and C++.

    Also, C is not a subset of C++, according to Bjarne Stroustrup, creator of C++.

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
      Alexander, yes you are correct and your post++ is more precise than mine. I updated my post. My word choice of "superset" is wrong. I know a lot more about C++ than I do about Perl 6, but I believe my basic point about relative similarity between the languages is true. I believe that some basic syntax in Perl 6, perhaps array access is just incompatible with Perl 5. I can write new C code that will work under both compilers (and have done so). I do not think that is possible with Perl5/6.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2024-04-24 22:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found