Allegro.cc - Online Community

Allegro.cc Forums » Off-Topic Ordeals » Additional programming languages

This thread is locked; no one can reply to it. rss feed Print
Additional programming languages
Thomas Fjellstrom
Member #476
June 2000
avatar

axilmar said:

It wasn't so solid after all, was it? :-)

Previous years it didn't have any. Where as IE and Mozilla did. Every year. Chrome just happens to have the best one. And it gets tighter every year. It helps that both that event and google itself are giving out a lot of money to try and attract people that can find holes in even the most stable stuff. Google itself has put in 1 million dollars (total) this year to give out to people finding security bugs in Chrome.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Specter Phoenix
Member #1,425
July 2001
avatar

I'm going back and relearning assembly. Using Emu8086 to do it (seeing as I bought the license during my college time). Like I forgot that the registers were AX, BX, CX, DX, AH, AL, BL, BH, CH, CL, DH, DL, DI, SI, BP, SP and SReg are DS, ES, SS, AND CS(as second operand only). Well back to learning.

[REVISION]
I need to learn to set it up in Ubuntu so I can do assembly there instead of being in Vista for it. ???

[REVISION 2]
Wine, amazingly runs Emu8086 just fine under Ubuntu.

Evert
Member #794
November 2000
avatar

I'm going back and relearning assembly. Using Emu8086 to do it (seeing as I bought the license during my college time).

Not to say you shouldn't fo that if you're doing it for fun, but the question is: why?

Quote:

Like I forgot that the registers were AX, BX, CX, DX, AH, AL, BL, BH, CH, CL, DH, DL, DI, SI, BP, SP and SReg are DS, ES, SS, AND CS(as second operand only).

By all means learn the principles, but don't get hung up on the details. Modern CPUs are very different from the old 16-bit 8086.

Specter Phoenix
Member #1,425
July 2001
avatar

Evert said:

Not to say you shouldn't fo do that if you're doing it for fun, but the question is: why?

My answer to 'why' will never be good enough for anyone's expected why. When I learned C++ I was told "Don't bother. Learn Perl, Java, C#, C, everything but C++". Same for any other language, when I started messing with Perl I was told to learn Python, started with Python was told to learn Ruby, started with Ruby was told to learn Haskell.

Though your previous post and this one seems contradicting.

Evert said:

It's still worthwhile to know, because it helps you understand what the machine is doing and how it's doing it (and you can look at the assembly translation from the compiler if you ever need to figure out what exactly the compiler is doing to your code), but the details are only relevant to particular architectures.

Evert said:

Not to say you shouldn't fo do that if you're doing it for fun, but the question is: why?

That is exactly why I quit asking questions because every answer I got was to learn a language to let me see how other languages do it, then get asked why I was wasting my time learning it. I still program in C++ and even have took up reading a book written by Josee Lajoie (who at the time of the print was the chair of the core language working group for ANSI/ISO C++ Standard Committee). I've come to realize that almost all books and tutorials on C++ are a waste as they only scratch the surface of what the language has or even can do. That is why I also have ordered the C++ The Programming Language Special Edition today. Figured his book would be even more beneficial than some book wrote by a guy looking to make a buck off the popularity of C++.

axilmar
Member #1,204
April 2001

Of course through a driver or API ::). That doesn't change anything. Being sandboxed doesn't solve the problem I described either.

You said: "Anyone could for example write a program that uses all your GPU power for computing (bitcoin mining for example)".

How is that a problem? since programs are being downloaded, one could download a program which uses all the available CPU power too. So, it is not a security problem. Even now, a Javascript program can have an infinite loop in it. I do not see how it is a security problem, if right now it is not a security problem for the current technology.

Quote:

Are you being picky on purpose to avoid answering certain questions? (I've seen you do this to several ones, not just this).

Not at all. You will get all your answers, do not worry. Please don't fall into the "axilmar avoids answering certain questions" trap, which has been laid primarily by the owner of allegro.cc because he regularly had his arguments beaten by me.

Quote:

I asked how would you do it, but instead of answering that, you told native controls are not used. Now you say native controls are not a problem. Make up you mind! (and answer the question)

I am using Firefox on a daily basis, and I see native and non-native controls all the time. I am not avoiding the question, I wanted you to see that the problem is already solved. But since you asked, here is the answer: through the proper abstraction of the underlying GUI system, which will be an API the downloaded programs can call to interact with native controls. Actually, the abstraction layer between the O/S and the downloaded program will cover not only GUI, but anything else necessary for writing interesting applications.

Quote:

Actually, no, the first time you said the library would be in the browser.

Nope. I said "stored in the browser". The question was "where would the library be stored?", and my reply was "in the browser". Putting the two together, it says "stored in the browser", which is totally irrelevant to being shipped with the browser.

Quote:

if I understand you correctly, web pages will include a line similar to import url_to_render_library.

You do understand me correctly. See? It's not that I cannot explain my ideas! :-)

Quote:

What happens if, after some time and a lot of webpages use it, that library goes off-line (forever)? Half the internet stops working? Not a good idea having to rely on a centralized thing.

The library would already be cached locally by the browser. A solution for this problem would be to have browsers ship with a standard library, which will be chosen in case the computer is offline and the imported library is not cached locally. The imported library would have priority over the one shipped with the browser, i.e. if the imported library is cached locally, it would be the one to be used.

Furthermore, there would certainly be different implementations, so, unless they all go offline simultaneously, there wouldn't be a problem. URLs can be redirected at DNS level.

A disclaimer about security: I am not implying I have all the security problems solved by what I am saying in these pages. These ideas rely on evolutions, which come from discussions by many people. My opinion is that a security "system" must be "invented" that covers all the possible security breaches, so as that we should be free to develop interesting applications and not worry about security. Perhaps it's not possible to do so, but thinking about it does no harm.

bamccaig
Member #7,536
July 2006
avatar

axilmar, I still fail to see any difference between your proposal versus what we currently have. Probably because I still fail to understand what your proposal even is, aside from replacing markup languages and stylesheets with programming instructions. Basically the same idea I had 4 or 5 years ago because I didn't want to learn how to use markup languages and stylesheets. :P Your pseudo-code was basically HTML, and amazingly did exactly what the HTML does. :P

Though I guess stylesheets raise an interesting question. The current Web is easily styleable, not only by Web authors, targeting specific devices (i.e., multiple stylesheets depending on the context of use); but also by end users within the user agent that want to change things around. A properly structured HTML document is easy to style differently, and in fact you can change the look of the entire Web page without touching a bit of markup or code if you're good enough. There's also the argument for MVC, or similar concepts, where the "view" or UI is separated from the logic and data. Are you familiar with MVC concepts? Do you disagree with them?

Evert
Member #794
November 2000
avatar

My answer to 'why' will never be good enough for anyone's expected why.

It's not important. What is important is that you have a reason to do what you do, that you've thought about what you're doing and know why you're doing it.

But that's not what I meant: why are you using an emulator to learn about assembly language for an obsolete architecture?

There are good and valid reasons for doing that, but be sure that your reason is one of those. If you want to learn something that you can directly use to program in assembly language on modern hardware on a modern operating system then this is the wrong way to go.

Quote:

When I learned C++ I was told "Don't bother. Learn Perl, Java, C#, C, everything but C++".

Largely irrelevant. Those languages are all very similar and it doesn't matter much which one you pick up first. Though I wouldn't start with C++ myself, that may just be because I didn't.

Quote:

Same for any other language, when I started messing with Perl I was told to learn Python, started with Python was told to learn Ruby, started with Ruby was told to learn Haskell.

So the question is: why are you trying to learn a particular language? I picked up Perl not for the heck of it, but because I wanted to post-process lots of data stored in text files and was getting sick of using a mix of bash shell scripting, sed and awk. Let alone writing custom C (or FORTRAN) programs to do it. Perl is a much better tool for that job.

Python is a more modern language that could do the same thing, and I did try both Perl and Python and found that I prefer Perl (in fact, I tried Python first). I'm sure I could have done it in Ruby if I wanted to, but it doesn't have the userbase and community that Perl and Python do.

Bottom line: it comes down to why are you learning a particular language? It doesn't matter so much which one you pick, but make sure you know why.

Quote:

That is exactly why I quit asking questions because every answer I got was to learn a language to let me see how other languages do it, then get asked why I was wasting my time learning it.

Are you sure you understood the questions?

Quote:

I still program in C++ and even have took up reading a book written by Josee Lajoie (who at the time of the print was the chair of the core language working group for ANSI/ISO C++ Standard Committee).

Never heard of him. Doesn't matter who he is either, since the position he holds doesn't say anything about his ability to write a good book about a language (but it looks good in the blurb on the back cover).

Quote:

I've come to realize that almost all books and tutorials on C++ are a waste as they only scratch the surface of what the language has or even can do.

You should ask yourself why they do this.

Ultimately you learn a programming language by using it, and you learn more as you go along. You do not learn to use C++ by using about all the different ways in which it can do the same thing in a book.

Quote:

That is why I also have ordered the C++ The Programming Language Special Edition today. Figured his book would be even more beneficial than some book wrote by a guy looking to make a buck off the popularity of C++.

Why?

The languages I use most are C, FORTRAN and Perl. I own one book on Perl, the introductory one (the "llama"), if I have use of a more advanced feature I use google or perldoc. I own one book on FORTRAN that I only ever open to remind myself of the edit descriptors. I have two books on C, but I hardly ever use either of them. I have them mainly because I like having a hardcopy reference if I ever need it. Again, you do not learn a programming language by reading about it in a book.

So once again, by all means do what you want to do, but make sure you have a sense of why you're doing it.

verthex
Member #11,340
September 2009
avatar

Evert said:

The languages I use most are C, FORTRAN and Perl.

Fortran is ugly, what do you need it for?

Evert
Member #794
November 2000
avatar

verthex said:

Fortran is ugly, what do you need it for?

Work, what else? A significant fraction of academic production software is written in FORTRAN.

FORTRAN 90 isn't that bad. Ofcourse a lot of code you find is written in FORTRAN 77 with coding conventions that date back to the 70s...

axilmar
Member #1,204
April 2001

bamccaig said:

axilmar, I still fail to see any difference between your proposal versus what we currently have.

Instead of downloading data like this:

<html>
hello world
</html>

Clients will download, compile and run data like this:

import foo.bar;

int main() {
    print("hello world");
}

I don't think I can make it any clearer for you: instead of documents, clients will download programs.

Quote:

There's also the argument for MVC, or similar concepts, where the "view" or UI is separated from the logic and data. Are you familiar with MVC concepts? Do you disagree with them?

All the desktop applications I've coded the last few years are based on the MVC model.

Arthur Kalliokoski
Second in Command
February 2005
avatar

axilmar said:

I don't think I can make it any clearer for you: instead of documents, clients will download programs.

Let's call it Coffee!

They all watch too much MSNBC... they get ideas.

verthex
Member #11,340
September 2009
avatar

Evert said:

By all means learn the principles, but don't get hung up on the details. Modern CPUs are very different from the old 16-bit 8086.

But those registers are the same for 8,16,32, and even 64 bits (the only difference is the operator name with an e for 32 bit and r for 64, 16 bits are broken into low and high for all the data registers). Only the simd instructions are different. And AT&T is backwards.

Evert said:

Work, what else? A significant fraction of academic production software is written in FORTRAN.

FORTRAN 90 isn't that bad. Ofcourse a lot of code you find is written in FORTRAN 77 with coding conventions that date back to the 70s...

Is there anything that you do with that that could be useful for entertainment purposes?

Arthur Kalliokoski
Second in Command
February 2005
avatar

verthex said:

Only the simd instructions are different.

What?!!??! You can use any register for a data pointer, you can multiply immediates and any register, you can use (simple) multiplication within an offset expression, you can push/pop all the registers at once, I'll stop now.

Quote:

And AT&T is backwards.

It's not what you're used to. I'm not used to it either, but "move <this> (to) that" is just as logical as "let (this) equal (that)".

They all watch too much MSNBC... they get ideas.

verthex
Member #11,340
September 2009
avatar

It's not what you're used to. I'm not used to it either, but "move <this> (to) that" is just as logical as "let (this) equal (that)".

I use GCC inline assembler a lot now (that is at&t right?). It was headspinning at first but the worst part of it is understanding the clobber list and remember things like this:

%%EAX ;register
$1 ;value

it makes masm look beautiful. :-/

Arthur Kalliokoski
Second in Command
February 2005
avatar

The clobber list is to tell GCC which registers you're "clobbering", it's not strictly assembler at all. MASM simply saves everything (or lets your code crash) instead of trying to be efficient about it.

They all watch too much MSNBC... they get ideas.

verthex
Member #11,340
September 2009
avatar

MASM simply saves everything (or lets your code crash) instead of trying to be efficient about it.

Well you can't put return values on the stack with gcc inline assembler so thats the reason I could imagine having one (clobber list), but with straight assembler you're supposed to push all the affected registers on the stack and pop them back after the operation is done (not like you didn't know that).

Arthur Kalliokoski
Second in Command
February 2005
avatar

But you don't know if a particular register needs to be saved or not, so you're possibly wasting cycles etc. The clobber list says "I need this, this and that, do whatever optimizations you can while honoring this".

They all watch too much MSNBC... they get ideas.

verthex
Member #11,340
September 2009
avatar

But you don't know if a particular register needs to be saved or not, so you're possibly wasting cycles etc. The clobber list says "I need this, this and that, do whatever optimizations you can while honoring this".

Only if you use the volatile keyword. I'm not sure how gcc compiles inline assembler without it and your assembly code might become more complex if the compiler is an idiot.

Basically your code without volatile might not even resemble what you coded.

Arthur Kalliokoski
Second in Command
February 2005
avatar

{"name":"Q5MlQ.gif","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/0\/b\/0bcc3605e17e942320de8f6c0592c726.gif","w":320,"h":233,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/0\/b\/0bcc3605e17e942320de8f6c0592c726"}Q5MlQ.gif

They all watch too much MSNBC... they get ideas.

Specter Phoenix
Member #1,425
July 2001
avatar

I love how the guy stands there and stares at it until it goes off ;D.

Evert
Member #794
November 2000
avatar

verthex said:

But those registers are the same for 8,16,32, and even 64 bits (the only difference is the operator name with an e for 32 bit and r for 64, 16 bits are broken into low and high for all the data registers). Only the simd instructions are different.

Flat memory model.
Protected mode vs. real mode.
Extra registers.
Different number of cycles used for instructions.
Pairing of instructions for concurrent execution.
Not to mention, simd instructions are rather relevant to programming on modern hardware.

Sure, some of those you don't necessarily need to know immediately, but it still means you'll need to watch out for picking up bad habits.

Quote:

Is there anything that you do with that that could be useful for entertainment purposes?

Not that I know of. I don't work on entertainment.

Tobias Dammers
Member #2,604
August 2002
avatar

axilmar said:

I don't think I can make it any clearer for you: instead of documents, clients will download programs.

What you haven't made clear yet is what you consider the difference.
Let's recap what you propose:

  • the client makes a request to the server

  • the server responds with program source code

  • the client runs the source code through a compiler and executes the result in a sandbox

Now let's see what we currently have:

  • the client makes a request to the server

  • the server responds with HTML, CSS, image data, or Javascript

  • the client does whatever it takes to display and/or execute what the server sent; usually, this means compiling HTML into a DOM tree, compiling Javascript into something executable, and then running the compiled Javascript in a sandbox to manipulate the DOM tree.

The web application in question can be implemented so that everything is done in Javascript except one line (<script type="text/javascript" src="the_program.js"></script>); if you do that, you end up with:

  • the client makes a request to the server

  • the server responds with a stub HTML document, which causes the following steps

  • the client makes a request to the server

  • the server responds with program source code

  • the client runs the source code through a compiler and executes the result in a sandbox

However, the current web stack is much more flexible than that: instead of doing everything in one programming language, things like document structure, layout, images, fonts, etc., can be expressed in more suitable formats.

So what exactly are you complaining about? How is your approach anything but a limited subset of what we already have? The only real difference I can spot is the syntax, but you have stated yourself that the syntax details are irrelevant. Everything else is already there. You can render your own controls in Javascript (either by generating CSS on the fly, or by using canvas, svg, or webgl); you can even do your own font rendering if you have masochist tendencies; you can include libraries; you can get limited access to the underlying OS and filesystem (at least since HTML5); you can make HTTP requests back to the server; honestly, what else do you want except a different syntax?

---
Me make music: Triofobie
---
"We need Tobias and his awesome trombone, too." - Johan Halmén

axilmar
Member #1,204
April 2001

What you haven't made clear yet is what you consider the difference.

The difference is that the browser will provide a much lower level API to the downloaded program, allowing much more versatility and expandability that the current model.

Quote:

However, the current web stack is much more flexible than that

More flexible? it's not more flexible. Try to make the world accept a new tag, and it would be years before it is adopted.

What we have now is a lot less flexible than what we could have.

Quote:

instead of doing everything in one programming language, things like document structure, layout, images, fonts, etc., can be expressed in more suitable formats.

A programming language can support those more suitable formats by providing the appropriate literal forms.

Quote:

So what exactly are you complaining about?

I already told you: a) incompatibilities between browsers, and b) the slow development of the standards.

Quote:

How is your approach anything but a limited subset of what we already have?

What I propose is a subset of what we currently have, but it's a more powerful one, allowing more and better abstractions to be built. Those abstractions are not possible with the current model.

Quote:

You can render your own controls in Javascript (either by generating CSS on the fly, or by using canvas, svg, or webgl)

Not all browsers support those things though. And there it goes: the incompatibilities between browsers mean a lot of extra work to make your web application available to the masses.

Quote:

you can even do your own font rendering if you have masochist tendencies

Exactly. With my idea, one could do his own font rendering without being masochist.

Quote:

you can include libraries

You can, but with hacks. The javascript import statement imports names, properties, objects and functions of another script, but javascript does not have a module loading system.

Quote:

honestly, what else do you want except a different syntax?

I want a proper API for my downloaded application. As it is right now, js programs cannot even write to a file without using custom browsers extensions.

Matthew Leverton
Supreme Loser
January 1999
avatar

With canvas + JavaScript you can do anything you want within the sandbox that the browser provides. You can complain about what that sandbox provides, but your solution is the same thing... just using slightly different tools.

(And, by the way, compiling source code can lead to incompatibilities ... look at gcc vs Visual C++. You're just trading one set of problems for a similar set.)

Of course, I would agree with you in that JavaScript has some fundamental flaws (e.g., lack of modularity), but I don't see how anything you are suggesting is a major upgrade from what we already have.

bamccaig
Member #7,536
July 2006
avatar

axilmar said:

I want a proper API for my downloaded application. As it is right now, js programs cannot even write to a file without using custom browsers extensions.

For fucking good reason. >:( When I visit your Web site it better not affect my computer in any fucking way.



Go to: