Author Topic: General Programming Megathread - New OP  (Read 29022 times)

text db "whats going on in here"
invoke printf, text
Code: [Select]
format PE GUI 4.0
include 'win32a.inc'

push MB_OK
push _cap
push _msg
push 0
call [MessageBox]
push eax
call [ExitProcess]

_msg db "forget you!", 0
_cap  db "A message:", 0

data import
library kernel, 'KERNEL32.DLL', user, 'USER32.DLL'

import kernel, ExitProcess, 'ExitProcess'
import user, MessageBox, 'MessageBoxA'
end data

woa ok big boy no need 2 start usin message boxs..

those posts are 20 seconds apart, I seriously doubt you wrote that in 20 seconds.

It's a syntax addition for something that is usually implemented on the stdlib level in other languages. I wouldn't call that minimalist.
so the forget what? it's convenient, and it's a small thing. adding one simple shorthand symbol doesn't turn over the entire purpose of the language.

No, Lua sucks because it seems to completely miss support for using libraries. It claims to have "meta-mechanisms" so that libraries can extend the language features. Well, except for that there doesn't seem to be a good way to actually handle said libraries. :)
"i can't use metatables, that means they aren't a good thing!"

bro metatables are probably one of the more useful things in lua, and if you can't use them, you're missing out, lol

While, yes, I'm generally biased towards Python and co., this is such a fundamental thing to get right, especially if your standard library is practically nonexistant (although even if it's comprehensive it should still be there).
by what you're suggesting, lua shouldn't even exist, due to the fact that if it were like other languages and to implement all of the standard functions you mention, there wouldn't even be a point, since you could just use another language to achieve the same thing.

lua wasn't created as a language on its own, but a framework for people to embed, add features to, customize, and expand.

just because it doesn't include everything you can do on your own, doesn't mean it's not "doing it right", it means you're a lazy forget who can't use a language unless it spoonfeeds you.

those posts are 20 seconds apart, I seriously doubt you wrote that in 20 seconds.
Quote
Dotdotcircle: I was going to paste that
Dotdotcircle: beforehand
Dotdotcircle: but never did
Dotdotcircle: it was just sitting in notepad
« Last Edit: November 09, 2012, 06:39:46 PM by Trinick »

woa ok big boy no need 2 start usin message boxs..

import java.awt.Graphics;
import java.awt.Color;

import javax.swing.JFrame;
import javax.swing.JPanel;

public class Window extends JFrame {
  class Hello extends JPanel {
    public void paint(Graphics g) {
      g.setColor(Color.black);
      g.drawString("hello", 20, 20);
    }
  }

  public Window() {
    setSize(200, 200);
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    setLocationRelativeTo(null);

    add(new Hello());
    setVisible(true);
  }

  public static void main(String args[]) {
    new Window();
  }
}


yeah this probably won't work, but you can't blame me for trying, lol

ewwwwwwwwwwwwwwwwwwwww java

so verbose


i only sort of agree
It's disgustingly verbose. Doing the same thing in C/C++ would take so many less characters.

It's disgustingly verbose. Doing the same thing in C/C++ would take so many less characters.
with or without an external library?


import java.awt.Graphics;
import java.awt.Color;

import javax.swing.JFrame;
import javax.swing.JPanel;

public class Window extends JFrame {
  class Hello extends JPanel {
    public void paint(Graphics g) {
      g.setColor(Color.black);
      g.drawString("hello", 20, 20);
    }
  }

  public Window() {
    setSize(200, 200);
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    setLocationRelativeTo(null);

    add(new Hello());
    setVisible(true);
  }

  public static void main(String args[]) {
    new Window();
  }
}


yeah this probably won't work, but you can't blame me for trying, lol
Code: [Select]
#include <windows.h>
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdList, int nCmdShow) {
MessageBoxA(NULL, "sage", "sage", MB_OK);
ExitProcess(0);
}
How polarizing.

with or without an external library?
With the default windows libraries.

i like java's class system, though

plus, java just looks generally better to me, C++ is so much less appealing. not sure why.

and yeah, dotdotcircle's example is only general purpose, since windows already has that type of window built in to where you could just spawn it.

the fact that you have to use more methods with Java makes it more flexible and able to fit your specific purpose.

i like java's class system, though

plus, java just looks generally better to me, C++ is so much less appealing. not sure why.
Are you seeing the same post as me? He did what you did in 525 characters in 172. What you did in 27 lines, he did in 5. How is Java more attractive in any way?

Are you seeing the same post as me? He did what you did in 525 characters in 172. What you did in 27 lines, he did in 5. How is Java more attractive in any way?
i'm exaggerating, but this is java:
Quote
i like dogs

this is C++:
Quote
%^m ;; ::* 8

but that's just me, i really don't care that much about length when it comes to things like this. obviously in this case, and i mean specifically in this case, using window's default libraries with C++ would be the better option, but for me, the way java works is something i prefer over using C++.