in reply to Re^3: Assembly language
in thread Assembly language

This code is not only machine specific, but it is OS specific.

Yes, you're right about that code being specific to an architecture and OS. However, I think the quibble here is that it's very different from what you originally said:

Assembly language is machine-specific, while perl is designed to run on any platform. If you write an assembly program for Linux, it won't run on DOS or Windows.

Stated so generally, that's not correct: some assembly programs can be run on multiple OSes. And I think "machine-specific" is too vague, as that could also be interpreted to mean that assembly code is specific to one particular computer; the Wikipedia quote you gave here is much more accurate. And some of your argumentation unfortunately goes against itself, like here:

... it would result in a Windows executable. If you tried to run it in Linux, it wouldn't run (without wine).

Wine Is Not an Emulator, and there's also the Windows Subsystem for Linux, which you may not have known about, but both these examples contradict your statement "... if you try to execute a Linux program in DOS or vice versa, it won't even load, because the OS does not recognize it as a valid executable." Yes, a compatibility layer is needed, but the assembly is executed natively. I also have to say I think you're muddying things between the concepts of ABI, assembly language, and actual binary processor instructions.

Another example: in this node you suggest that adding assembly to Perl will make it less portable, which is of course true across processor architectures, and it's true when comparing a Perl program with assembly to one without assembly. But in the same paragraph you mention portability across OSes, and here I'd say that using inline assembly in Perl can actually make the assembly more portable than the same assembly code without Perl. The same is true for assembly embedded in C code, which most if not all C compilers support. Take your initial example:

So, even if the program is designed to do a very simple task such as calculate the value of PI. No file access needed. No internet access needed. No libraries have to be loaded. Just do a bunch of calculations and print the result to the screen.

The only thing in that whole program that is OS-specific is the output part. If all the assembly had to do was return that value in memory to Perl instead, and Perl does the printing, then suddenly you have portability across all OSes on the same processor architecture (that Perl runs on; another point you gloss over in your various posts). See the example in the synopsis of Inline::ASM, for example.

Don't get me wrong, when it comes to 80386 assembly, I think you know your stuff. Rereading your posts here, I also understand the points you were trying to make. Here you said "You know what I am talking about," and yes, we know what you're talking about. But remember that this is all taken in the context of helping newcomers: making over-generalized statements, sometimes conflicting and/or inaccurate ones, can muddy the waters and cause confusion, and potentially be more damaging than helpful. I would suggest being more careful with the language you use to explain things.

Replies are listed 'Best First'.
Re^5: Assembly language
by harangzsolt33 (Deacon) on Dec 15, 2019 at 15:51 UTC
    Ok, I will try to be more precise next time.

    I just had the feeling that the original poster was not familiar with assembly language at all. And I thought combinging perl with assembly is probably not where he should start. I mean, you can put assembly code in just about anywhere. You can insert it into C or C++. One can insert inline assembly even into BASIC if one is really determined. lol But I don't think these are the best or easiest ways to learn about assembly. I would call this the more advanced stuff. So, if I just started learning about assembly, then combining languages is not where I would start.

      I just had the feeling that the original poster was not familiar with assembly language at all. And I thought combinging perl with assembly is probably not where he should start.
      Like the last time, if you are not sure ask. Also, drop the lols, this isn't facebook.