Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-4041-8081-120121-160161-

I want...

Name: Anonymous 2011-07-09 15:55

A language that:
- Can be compiled to native code.
- Can use OO abstractions.
- Is not Java.
- Is not C++.
- Is not C#.

What I am searching for?

Name: Anonymous 2011-07-09 16:00

C or Common Lisp.

Name: Anonymous 2011-07-09 16:01

Lisp, Smalltalk, Ocaml, D, ...

Name: Anonymous 2011-07-09 16:04

>>2
>>3
typical lisptards...

Name: Anonymous 2011-07-09 16:05

LuaJIT

Name: Anonymous 2011-07-09 16:06

no mention of wanting lambda abstraction as well as OO

unenlightened detected.

Name: Anonymous 2011-07-09 16:26

ANSI-C

Name: Anonymous 2011-07-09 17:14

>>1
If you're not willing to accept a VM language, OCaml is your best bet unless you want a C language for some reason.

If you're happy to include languages in development, check into BitC, Clay and Rust.

Name: Anonymous 2011-07-09 17:26

Common Lisp, Scheme (OO as a library), O'Caml, Haskell, C (structs+macros), assembly (careful use of structures and macros).
If they can compile to native code depends on the implementation, but all the languages listed have compilers that target some platform's native code (directly or indirectly(through some IR or C)).

Name: Anonymous 2011-07-09 17:53

>>7
/thread

Name: Anonymous 2011-07-09 18:01

>>10
It doesn't have thread. Also, /thread is unspecified behaviour.

Name: Anonymous 2011-07-09 18:01

Everyone here reccomends OCaml? Wat

Well, if I add the condition
- I am planning to use it for building a network protocol over it.
the responses change?

Name: >>3 2011-07-09 18:08

>>12
Lisp, I'm not sure about the state of Ocaml's networking libraries.

Name: Anonymous 2011-07-09 18:13

>>13
tro[spoiler][b]STACK OVERFLOW[/spoiler]

Name: Anonymous 2011-07-09 18:22

>>12
Why exactly should that change anything?

Name: Anonymous 2011-07-09 18:23

>>15
ENTERPRISE SCALABLE SOLUTIONS

Name: Anonymous 2011-07-09 18:48

>>15
I don't know, that's why I am asking.

Name: Anonymous 2011-07-09 20:18

too bad lisp is for faggots

Name: Anonymous 2011-07-09 21:34

Go.

Name: Anonymous 2011-07-09 22:26

>>19
Not even funny. No one wants to pretend to write python while pretending to write java.

Name: Anonymous 2011-07-10 0:27

>>20
It's nothing like Java.

Name: Anonymous 2011-07-10 1:23

Somebody explain what is meant by OO abstractions. Is this merely a reference to the OO model as a means to represent data?

I was once told that C++ had poor abstraction power, so I don't think this is what is meant...

Name: Anonymous 2011-07-10 4:24

Just bumping some non autistic thread

Name: Anonymous 2011-07-10 4:45

>>22
For OO abstractions i meant that you can do some part of what you can express in UML, at least. You can do this fairly good in Java, excluding multiple inheritance (yeah, you can do this with interfaces blah blah blah no you) but Java is teh cancer, and you can't use Java for developing low level shit.

Name: Anonymous 2011-07-10 7:26

Don't you fags swoon over D?

Name: Anonymous 2011-07-10 8:01

Haskell ofcourse

Name: Anonymous 2011-07-10 8:02

One word the Objective C of code. Thread over.

Name: Anonymous 2011-07-10 8:39

Object Pascal

Name: Anonymous 2011-07-10 8:51

Vala

I haven't tried it myself though, I like C++.

Name: VIPPER 2011-07-10 11:16

Vala Shambala

Name: Anonymous 2011-07-10 11:38

>>29
It really does sound interesting.

Name: Anonymous 2011-07-10 13:53

Seconding Go

Name: Anonymous 2011-07-10 14:27

C++/CLI :|

Name: Anonymous 2011-07-10 22:18

>>21
It's a lot more like Java than you think, particularly in the gimped object system.

Name: Anonymous 2011-07-11 14:31

ENTERPRISE LAMBDA TOURING

Name: Anonymous 2011-07-11 16:03

>>12
Erlang.

Name: Anonymous 2011-07-11 17:10

anic

Name: Anonymous 2011-07-11 21:39

>>33
JIT

Name: Anonymous 2011-07-12 1:28

C

Name: Anonymous 2011-07-12 2:10

Name: Anonymous 2011-07-12 4:00

Scala/LLVM

Has better performance than Lisp SBCL and Java, with only C/C++, Ada, and Pascal/Delphi being faster.

Name: Anonymous 2011-07-12 4:02

>>41
Also, Haskell/LLVM, although it's a bit slower than Scala/LLVM.

Someone needs to make an LLVM backend for Common Lisp.

Name: Anonymous 2011-07-12 6:50

>>41
>>42
Now that we are talking about the performance of Common Lisp implementations, how fast are the commercial Lisps such as Allegro and LispWorks?

Name: Anonymous 2011-07-12 10:05

>>43
About 9.8 m/s2

Name: Anonymous 2011-07-12 13:48

>>44
That's acceleration, not speed, ``faggot''.

Name: Anonymous 2011-07-12 13:50

>>45
Not everyone here passed our high school science classes.

Name: Anonymous 2011-07-12 14:36

>>45-46
If something accelerates uniformly instead of maintaining a constant speed, it makes sense to answer your question with the acceleration, assuming your not dumb enough to figure it out by yourself, ``fucking lithp faggot''.

Name: Anonymous 2011-07-12 15:00

What modern languages there are nowdays that do not have garbage collector and is not C or C++?

Just asking because GC is shit.

Name: Anonymous 2011-07-12 15:04

>>48
Fuck not you again.

Okay, go play with Haskell for a while and shut the fuck up.

Name: Anonymous 2011-07-12 15:12

>>48
GC is shit

enjoy ur copying data and/or manual reference counting that has nothing to do with the problem you're solving

Name: Anonymous 2011-07-12 15:14

>>50

forgot AIDS. manual memory management is AIDS.

Name: Anonymous 2011-07-12 15:20

fuck this, I refuse to argue with retard.

Name: Anonymous 2011-07-12 16:02

>>52
the pain in your butt... it is delicious

Name: Anonymous 2011-07-12 16:21

>>47
EXPERT FREE FALL

...splotch!

Name: Anonymous 2011-07-12 16:28

>>49-53

Are you fucking kidding me kids?

You think it's not possible to code withouut GC. Just fucking release your memory in destructor and all is fine. WTF is wrong with you. Fucking Java faggots.

I mean Java does not suck that much, and GC is almost OK but it kills the performance and I just like to RAII more. If you can't code without GC, then there are something wrong with your programming skills.

I ahree to use GC only for scripting languages.

Name: Anonymous 2011-07-12 16:37

>>55
We've already had this thread. http://dis.4chan.org/read/prog/1309069880

Name: Anonymous 2011-07-12 16:40

>>54
fuck you lithp fagstorm

Name: Anonymous 2011-07-12 16:40

>>55
I grew up on C and C++.

And I think manual memory management is about as silly as manual CPU register management. (Seriously, demonstrate that there is an essential difference, please.)

Shared references, as a general technique, is also insanely useful. It's not just that having to keep track of "owners" is tedious, it also limits your design considerably.

I tend to write ad-hoc reference counting and GC pretty regularly while writing C++.

Name: Anonymous 2011-07-12 17:43

>>58
Manual register allocation is silly, because the compiler will do it better.

Manual memory managment is not silly, because it is very easy, more predictable and more effiecient.

Name: Anonymous 2011-07-12 17:56

>>59
more effiecient.
Allocation on copying GCs is done in constant time, malloc is not.
A minor garbage collection (assuming a generational GC) is proportional to the amount of live data. Most object die shortly after being allocated. Free is not smart. The GC can do major garbage collections in a separate thread.

Name: Anonymous 2011-07-12 18:13

>>60
1.Time complexity != execution time
2.Use system calls instead of glibbloat.
3.What do you plan to do on single-processor systems?
4.You are a ``faggot'' for reliying on another things than your cock and your fingers.

Name: Anonymous 2011-07-12 18:35

Manual memory management is stupid unless you're working on embedded systems in C. If you're working in anything higher level than C you have no right to complain about GC and doing so makes you an idiot.

Name: Anonymous 2011-07-12 18:53

Ruby

Name: Anonymous 2011-07-12 19:53

>>61
1.Time complexity != execution time
You just bump a pointer. Like with stack allocation.
2.Use system calls instead of glibbloat.
You still have to search for a free block of memory.
3.What do you plan to do on single-processor systems?
Use an incremental GC.
4.You are a ``faggot'' for reliying on another things than your cock and your fingers.
Make your own processor, with your own instruction set, then write your own assembler for it, then your own programming language and compiler for it, then the library, then the OS.

Name: Anonymous 2011-07-12 20:47

>>59
very easy
defect rates disagree. Garbage collection is easily correlated with fewer and easier to correct bugs. Enjoy ur heap corruptions.

more predictable
What are you trying to predict? If you know your machine has 4gb available, predictability isn't important. Regardless, there are garbage collected languages with EXTREMELY predictable memory usage, such as PicoLisp.

more efficient
not unless you write your own manager. malloc's performance is not that predictable and C doesn't really give you the tools to reason well about cache coherency anyway. If you're going to abstract SOME aspects of memory, you might as well abstract all of it. Why aren't you arguing for assembly? The C stack is a very rudimentary form of automatic memory management. It just sucks. Why does it get a free pass?

If you care about efficiency you ARE going to write your own memory manager. It may or may not be faster and less buggy than one used by a language implementation. Probably not. It may or may not include reference counting or garbage collection, and therefore make everyone's life easier. Probably not.

Name: Anonymous 2011-07-12 20:51

>>59
Manual register allocation is silly, because the compiler will do it better.

Nope. It's silly because it can easily be made automatic. Programmers shouldn't do things that can be made automatic. Optimization is almost never a good reason. For anything. And at almost never conflicts with the principle of automation. Especially with time. Soon garbage collectors will be faster than all but the most skilled* C programmers, just like compilers are now faster than all but the most skilled* assembly programmers.

* in the sense that a manual laborer is skilled.

Name: Anonymous 2011-07-13 0:48

>>48
OCaml, Clay.

Manual memory managment is not silly, because the compiler can't do it at all.
FTFY. Seriously guys, static analysis.

Static analysis: it doesn't always make it faster but it never makes it slower at run time.

I don't mind GC usually. I do however avoid java and python for anything with a UI bec ause of it. If you're going to use GC ffs choose a responsive one.

Name: >>67 2011-07-13 0:50

Shiichan seems to have eaten the >>59 from my post.

Name: Anonymous 2011-07-13 4:03

>>67
OCaml
What? Last time I checked, it did have a GC.

Name: Anonymous 2011-07-13 12:40

>>67
OCaml, Clay.
OCamls seems to have GC. Clay does not seem to be ready.
I just stick with C++ for now.

Name: Anonymous 2011-07-13 13:04

>>70
C++ seems to have GC. C does not seem to be ready.
I just stick with Java for now.

Name: Anonymous 2011-07-13 13:09

>>71
lol, u so funny

Name: Anonymous 2011-07-13 16:56

>>69
It does, but you can control it.

Name: Anonymous 2011-07-13 22:53

I want a language that...

A language that:
 - Cooks
 - Cleans
 - Sucks my dick
 - Takes it up the ass
 - Doesn't bitch
 - 100% faithful
 - Doesn't spend money
 - Doesn't talk

Name: Anonymous 2011-07-13 22:55

>>74
u mena Lua :)

Name: Anonymous 2011-07-13 23:43

13 July 2011

   The US Government is due to establish a Federal Programming Administration (FPA) over the next few weeks. During this time, government officials will be screening individuals for administrative positions and will be laying the groundwork for guidelines which all software companies will soon be required to follow.
   Under these guidelines, all computer code will be required to meet a level of quality. "Obviously, there is a lot of code in the market already," explains government technical expert Ryan Jennings. "Thus, the FPA will only screen software by a complaint-by-complaint basis." Jennings goes on to describe a couple of the guidelines. "In the future, programs will have to start up in less than a couple of seconds. The programs themselves have to be programmed in one of the many enterprise languages which are widespread in use, such as Java, VB.NET, and PHP. Remember, a positive user experience is everything here and the FPA will ensure that it happens."
   US Congress is due to pass a set of laws in the future which will halt the distribution of computer software deemed "low-quality" by the FPA. According to Jennings, "The goal here is to lower and eventually eliminate the already high amount of poor quality software. Top issues in the agenda include the elimination of functional programming, a sub-par programming practice, and particularly open-source software. Open-source software is seen as destructive to the economy so we already have plans to ban its production." The screening process is estimated to be completed in a few days. "It's only a matter of time, but I'm certain this is going to work out. I really see a bright future in the computer industry."

Name: Anonymous 2011-07-14 0:53

>>55
I've never written a concurrent, multithreaded program or anything over 100 LOC and have no idea what the fuck I'm talking about.

FTFY.

Name: Anonymous 2011-07-14 0:54

Use Prolog. Become enlightened.

Name: Anonymous 2011-07-14 2:10

DELPHI god tier language with RAD support, its like C# and C++ together.

Name: Anonymous 2011-07-14 3:59

>>1
- Can use OO abstractions.

You're searching for a shitty language.

A good language should allow you to trivially express common OO abstractions with higher level, simpler constructs, without needing OO explicitly wired into the language syntax and semantics. Then you will realize while using these higher level constructs that you don't fucking want to do OO in the first place.

Name: Anonymous 2011-07-14 4:01

>>77
itt people think memory management is hard

Name: Anonymous 2011-07-14 4:03

>>81
Get out.

Name: Anonymous 2011-07-14 4:07

>>82
NO U

In all seriousness, are you one of these idiots who think it's impossible to write correct, scalable code that manually manages memory? Do you think the Linux kernel or the Unreal engine fell out of the sky?

Name: Anonymous 2011-07-14 4:17

>>83
It's possible, just like it's possible to write correct, scalable code in pure assembly.
In all seriousness, are you one of those idiots who think they have control over machine just by manually managing memory?

Name: Anonymous 2011-07-14 4:28

>>58
And I think manual memory management is about as silly as manual CPU register management. (Seriously, demonstrate that there is an essential difference, please.)
That's downright silly. Using automatic register allocation does not cause periodic stalling of your program while a 'register collector' is run. A garbage collection pause, on the other hand, can severely impact the user experience, and tweaking it to make it less noticeable has significant impact on the resource consumption of the application. There's a reason why no modern game engine is written in a garbage collected language.

Shared references, as a general technique, is also insanely useful. It's not just that having to keep track of "owners" is tedious, it also limits your design considerably.
Failure. You *should* be tracking the ownership of each object as part of the design of your program. Many objects actually need to have explicit ownership because they need to be cleaned up: file handles, network sockets, sql statements and cursors, etc. It's much better to have a good idea of the ownership of all objects.

I tend to write ad-hoc reference counting and GC pretty regularly while writing C++.
You're doing it wrong. So very, very wrong. The resulting code is likely slower than using a GC; if you're too incompetent to manually manage your memory, then use a GC language for fuck's sake, but don't pretend like this is a good thing. I hope I never have to maintain your code. (For the record, I think shared_ptr<> is cancer and you are cancer for using it. scoped_ptr<> and unique_ptr<>, on the other hand, are wonderful.)

>>65
What are you trying to predict? If you know your machine has 4gb available, predictability isn't important.
Dude, it's not about the total memory usage. A big part of it is being able to control the layout of your memory so you get consistent and predictable cache performance. An equally important part is predicting that you won't get a goddamn GC pause in some innocuous piece of code (and before you say malloc is unpredictable, yeah we know it is, which is why manual memory management allows me to write performance-critical sections without fucking allocating memory.)

Name: Anonymous 2011-07-14 4:33

>>84
In all seriousness, are you one of those idiots who think they have control over machine just by manually managing memory?
No; I think I have control over when a GC stall is going to occur. Never. :) I also have a much better idea of the *actual* resources that will be consumed by my application, and that it won't consume an order of magnitude more resources than it actually needs in order to run at a pace that the user will enjoy.

Name: Anonymous 2011-07-14 4:43

>>86
:)
*actual*

Oh, now I understand.

Name: Anonymous 2011-07-14 6:35

>>80
Mind an example of this language?

Name: Anonymous 2011-07-14 6:52

>>88
Anything with proper anonymous functions.

Name: Anonymous 2011-07-14 7:02

>>89
Ah, ok, then that's IHBT

Name: Anonymous 2011-07-14 7:11

>>90
Objects are poor men's closures.

Name: Anonymous 2011-07-14 7:15

>>91
[i]ONE WORD THE FORCED CLOSURE OF THE LAMBDAS[/i]

Name: Anonymous 2011-07-14 8:21

D
/Thread

Name: Anonymous 2011-07-14 8:26

Go!


main .. {
  include "sys:go/io.gof".
  include "sys:go/stdlib.gof".

  main() ->
      drink(99);
      stdout.outLine("Time to buy some more beer...").

  drink(0) -> {}.
  drink(i) -> stdout.outLine(
       bottles(i) <> " on the wall,\n" <>
       bottles(i) <> ".\n" <>
       "take one down, pass it around,\n" <>
       bottles(i) <> " on the wall.\n");
      drink(i-1).

  bottles(0) => "no bottles of beer".
  bottles(1) => "1 bottle of beer".
  bottles(i) => i^0 <> " bottles of beer".
}

Name: Anonymous 2011-07-14 8:28

>>94
ONE WORD THE FORCED CAPITALIZATION OF EXPORTED SYMBOLS THREAD OVER

Name: Anonymous 2011-07-14 13:44

>>88
Any language with real first-class closures. JavaScript is a good example of this: the way it does OO is basically glorified closures. The best example is of course Lisp, but I wasn't about to bust that one out first, since you've probably already stopped reading this post by now.

Name: Anonymous 2011-07-14 14:06

>>96
Lisp
stopped reading after that

Name: Anonymous 2011-07-14 14:12

>>55
I mean Java does not suck that much
HAHAHAHA OH BOY

Name: Anonymous 2011-07-14 14:24

Working without GC is easy, at least in C++.

Most of the time you can just use stack. When you actually need heap allocation, most of the time you can wrap it in class and release the memory in destructor. That way you won't get  memory leaks.

Sometimes you don't have to wrap the memory in class yourself, but you can use auto_ptr (deprecated) or unique_ptr. That is just as effective as manually using new and delete, but is exception safe and is easier to manage (also you can't forget to free memory). shared_ptr is also ok in some cases, but has some overhead and you can avoid using that by just designing your code better.

However, you have to keep the releasing of the memory in mind when you design your program. If you cannot do that, you are a bad programmer, and should just use GC language.

It really isn't that hard. Only thing you have to remember, is that whenever you use new, you have to also have some mechanism to free the memory.

I agree GC is ok for some cases, for example in scripting languages, where you don't need a good performance. However, many applications that have be coded with GC'd language (like C# or Java) are slow. I'm not sure if it's because they are not native code or because of GC? Some people claim that JIT should make the byte code as fast as native code, so that leaves the GC to be blamed. Or maybe it's because the "premature optimization is the root of all evil" claim that makes these software slow? I don't think so, because software written is C is almost always fast, and software written in C# and Java is almost always slow.

Or maybe it's because coders that need GC are bad programmers and produce slow code?

Name: Anonymous 2011-07-14 16:01

>>99
You do really think that for most applications, storage that lasts just for the dynamic extent of a procedure will be enough? Suddently, applications have to maintain no state?
However, many applications that have be coded with GC'd language (like C# or Java) are slow. I'm not sure if it's because they are not native code or because of GC?
I don't know for .NET, but the JVM is slow because it has to load all the bloat first, and the JIT has to warm up and find the hotspots in your program.
Some people claim that JIT should make the byte code as fast as native code, so that leaves the GC to be blamed.
A JIT emits ``native code'', you damned moron. And the GC doesn't run perpetually, and surely not at the startup.
Or maybe it's because the "premature optimization is the root of all evil" claim that makes these software slow?
Explain why not assembly, if premature optimization is not evil.

Also, you keep saying ``GCed language'', but I don't see the word ``GC'' in Java's spec, or Lisp's, Scheme's, ....

Name: Anonymous 2011-07-14 17:05

>>100
Also, you keep saying ``GCed language'', but I don't see the word ``GC'' in Java's spec, or Lisp's, Scheme's, ....
Your estimated IQ dropped at least 50 points after I read your last phrase.

Name: Anonymous 2011-07-14 17:58

>>97
Don't be a faggot.  He's talking about Lisp's indisputably sane semantics.  He's not even advocating it or acting elitist towards users of other languages.  I say, you are doing a great injustice to >>96-san.

Name: Anonymous 2011-07-14 18:31

>>100
Classic sheltered GC defender, falling back on insults and personal attacks instead of coming up with good arguments.

I don't know for .NET, but the JVM is slow because it has to load all the bloat first
wat

I don't get all this JIT discussion. It has nothing to do with GC. And yes, Java is slow largely because of GC. 98% of the software engineering investment in the JVM has been for the GC.

Name: Anonymous 2011-07-14 19:16

>>103
Classic sheltered manual memory management defender, falling back on idiocy and irrelevant details instead of coming up with good arguments.

Name: Anonymous 2011-07-14 19:28

THIS IS A MESSAGE FROM THE SUSSIX DEV TEAM

If ``premature optimization is the root of all evil'' will intentionally writing slow code make our programs inherently good?


THIS HAS BEEN A MESSAGE FROM THE SUSSIX DEV TEAM

Name: Anonymous 2011-07-14 19:47

You guys are forgetting something really important.

GO KILL YOURSELVES

Name: Anonymous 2011-07-14 19:53

>>103
I don't get all this JIT discussion.
You mentioned the JIT.
>>101
Your estimated IQ dropped at least 50 points after I read your last phrase.
You can do automatic memory management without a GC. And the specs still don't mention a GC anywhere.

Name: Anonymous 2011-07-14 20:24

>>85
Using automatic register allocation does not cause periodic stalling of your program while a 'register collector' is run.

automatic register management being efficient is a relatively new invention.

A garbage collection pause, on the other hand, can severely impact the user experience, and tweaking it to make it less noticeable has significant impact on the resource consumption of the application.

this depends on the garbage collection algorithm. I agree that Java's is unsuitable. I've never seen such bad "hiccups" in other implementations, except occasionally with C#.

There's a reason why no modern game engine is written in a garbage collected language.

XNA. Love2d. Moai. Also, EVERY modern game engine has at least 1 scripting language for doing non-intensive things. I seriously give it 5-10 years until you start seeing ground up game engines written in something like LuaJIT.

>you *should* be tracking the ownership of each object as part of the design of your program. Many objects actually need to have explicit ownership because they need to be cleaned up: file handles, network sockets, sql statements and cursors, etc. It's much better to have a good idea of the ownership of all objects.

dynamic-wind (or whatever, it's trivial to implement.) Closures win again. In CL you can even do it with a macro like C# essentially does with its "using" statement. Sorry, but dealing with that kind of stuff is easy with lambdas, and far more explicit than overloading the semantics of "}" the way C++ does. Tying this stuff to the lifetime of an object is a hack to get syntactic sugar, just like everything else in C++.

Name: Anonymous 2011-07-14 20:36

I remember the day that I realized that the C stack was a really limited automatic memory manager. It's probably in the top 20 enlightening moments.

Name: Anonymous 2011-07-14 21:08

>>105
No. The idea is that you write code that is correct. You will then profile that code to get some data about where you need to optimise.

Name: Anonymous 2011-07-14 23:39

>>107
You mentioned the JIT.
Newsflash: there are more than two of us in this thread. *gasp*

>>108
automatic register management being efficient is a relatively new invention.
And automatic memory management is a relatively fictional invention.

I'm not sure what your point is either. People still wrote a lot of stuff in assembly until compilers became efficient. It's 2011 and garbage collectors are still grossly inefficient, so doesn't it make sense to skip them for non-trivial applications? We've seen how slow and unresponsive Java apps like Eclipse can be. They're awful. Besides, manually managing memory is not nearly as difficult or time-consuming as handcoding assembly; in fact memory management comes naturally in a well-designed application.

modern
XNA. Love2d. Moai.
I lol'd

Name: Anonymous 2011-07-14 23:48

>>92
ONE WORD THE FORCED FAILURE OF THE BBCODE

Name: Anonymous 2011-07-15 0:43

>>111
there are lots of non-trivial applications that aren't CPU bound or don't need to be performant anyway. For instance, anything that runs on a server and/or deals with a database.

Also Java's performance is due to the fact that it is its own virtual machine. Nobody embeds Java, so there's no way to optimize it by going native.

I think this needs to be said over and over: something is optimized if and only if you can optimize it later after profiling. This is why I consider embedded languages to be faster than giant VM languages. (Please don't use Java as a golden standard of anything because it's not. Nobody here is arguing for Java.)

in fact memory management comes naturally in a well-designed application.

I disagree. Your standards are not correct. Trust me -- I used to think the same thing. But shared references are the way. Good designs use them constantly. But good C++ designs don't. Get it? It's very simple. C++ encourages BAD design, not good.

Name: Anonymous 2011-07-15 0:46

>>111
And automatic memory management is a relatively fictional invention.

He still thinks managing memory is an essential and unsolved problem worthy of premature attention and man-hours before profiling!
laughinggirls.jpg

Name: Anonymous 2011-07-15 0:55

>>114
Go back t-ah, fuck it, you're right.

Name: Anonymous 2011-07-15 12:19

>>113
there are lots of non-trivial applications that aren't CPU bound or don't need to be performant anyway. For instance, anything that runs on a server and/or deals with a database.
Most software that deals with database are boring and trivial enterprise software.

Also Java's performance is due to the fact that it is its own virtual machine.
No, it's because the GC is slow and the GC encourages programmers to code badly without understanding what affects to the performance. So there are at least two reasons why GC makes Java slow.

But shared references are the way. Good designs use them constantly.
Wtf? Why sould I believe you. Do you have any proof? Have you tried designing your code better?

It's very simple. C++ encourages BAD design, not good.
Not very simple at all. Who says C++ encourages bad design? You? Citation needed!

Name: Anonymous 2011-07-15 12:22

>>116
This.

Name: Anonymous 2011-07-15 12:53

I don't understand why is reference counting evil.

I'm currently developing a Seihou ripoff in C (not sepples) and I have two basic projectiles types:
- The entity, which contains the state of a bullet and a reference to a function used by a very simplistic virtual machine in order to compute the state from the time the entity has lived;
- The polyline, which is a linked list of pointers to entities.
A polyline is rendered as a polyline connecting the entities, and an entity is simply a sprite.

I'm using reference counting and an ENTITY_INVALID flag in order to permit the removal of an entity while polylines or VM threads still refer to it. When there's a hole in the polyline, I split it in two, and I kill threads referring to invalid entities. Is it bad design?

Also, but that is completely unrelated to the subject, the VM is currently executing an extremely shitty bytecode produced by NASM macros abuse and I'm thinking of replacing it with a Lisp-like interpreter.

Name: Anonymous 2011-07-15 13:02

>>116
Java isn't slow because the GC is slow. You should know this.

Name: Anonymous 2011-07-15 13:08

>>118
Reference counting has some things people need to be aware of. If you don't use it correctly, you will pay the price.

To correctly do reference counting in C or C++, you need to make the release operation thread-safe, so that if two threads hold a reference to the same object, if the threads release the object at around the same time, it's possible you'll get a double-free unless you protect the reference count.

Generally, this is done using native CPU specific atomic compare-and-swap instructions. These instructions lock cache-lines or even the memory bus. On x86/x86-64, for example, a compare-and-swap takes around 150-200 cycles (where as say a simple dec and jnz might would just be a couple of cycles granted that the reference count is in the CPU cache and the branch predictor doesn't fault.

There's overhead. Therefore you should avoid lots of fine-grained reference counted objects. You don't need to use reference counting for everything. Use reference counting only where you need to, and on heavier-grained objects which explicitly manage smaller-grained objects. That way you can setup strong ownership rules: when the heavier-grained object goes out of scope or is released, it will cleanup and free all of the fine-grained objects it owns, no expensive reference count release operations.

There are also different ways of implementing reference counting: intrusive and external. Intrusive is less expensive in practice, less memory fragmentation, single malloc and free per object, but you can't have weak references which are useful for implementing cycles. External reference counting is more usable, but often allocates the reference count in it's own block of memory, although there are ways to make it intrusive (see C++'s std::make_shared function).

Name: Anonymous 2011-07-15 13:23

>>118
And yes, it does sound like a bad design. Your entities should probably not use reference counting... reference counting is more for like a group of entities or larger subsystems.

If I were implementing your game, I'd be using the structure of arrays approach, using homogeneous arrays for each entity field/component. Removing an entity would just involve setting a flag, and at a synchronization point during the update pipeline, I would remove the entity by copying the remainder of each array over the entity offset and decrement the entity count.

No reference counting. The entity system/scene graph has strong ownership of the entity arrays, which are generally allocated at load time and have a fixed upper bound.

If you need an object-oriented class to coalesce all of the fields from each array for a particular entity offset/id, just create a simple object-oriented view abstraction, similar to how you can create views in RDBMSes.

This is the data-oriented approach which is popular among professional game developers for modern games. It's fast as fuck, it's easier to parallelize, and doesn't thrash the cache or fragment your allocators. It also usually ends up being less code too than an more OO approach.

Fine-grained object-oriented factory systems for entities/game objects is the amateur design.

Name: Anonymous 2011-07-15 13:37

>>116
Most software that deals with database are boring and trivial enterprise software.

hint: almost all software is essentially pretty trivial. SQL is a functional domain-specific programming language that lets you deal with databases in a trivial fashion. A C++ solution that used no other (superior) technology would turn it into a non-trivial application, just like it does everything else. Triviality is more often dependent on accidental complexity and implementation than it is on essential complexity and the real problem. If you think in C++, you probably have no idea what I'm actually talking about.

Wtf? Why sould I believe you. Do you have any proof? Have you tried designing your code better?

I used to be a C++ fanatic. I saw the light. Here's the thing: when you use a C++ style to design code in a language with proper closures, you get an unmanageable mess (actually, this is what most Java programs are,) and vice versa. So those two positions of the grid are obviously bad. The comparison is C++ style in a C++ program vs closure style in a closure language, and it's not even close. I have literally written code before and thought "the C++ way to solve this (ie not to translate what I'm doing but to do it the legit C++ way) would be 10 times as much code." This is NOT bad design. Less code is always fewer bugs, _easier_ to optimize (provided you can go native,) and easier to manage. For instance, it's actually worth using dynamic typing because your code will be that much smaller that you wan't need static analysis to understand what's going on. I know it's hard to believe, but it's true.

GC encourages programmers to code badly without understanding what affects to the performance.

Am I being trolled? It's true that GC lets you forget about a lot of bullshit that you need to do to write good C++. This is what abstractions are for. Ignoring detail that is meaningless to the problem domain. Again, it's not really essentially different from the details that C lets you ignore about assembly (which actually includes things like cache coherency. The "1-d plain of memory" abstraction leaks like crazy, performance-wise.)

Wtf? Why sould I believe you. Do you have any proof? Have you tried designing your code better?

Not using shared references when it's easy and guaranteed bug-free is a mindlessly tedious and masochistic restriction. How is this not obvious?

Who says C++ encourages bad design? You?

Lots and lots and lots of people. Try googling it. C++ is probably the most legitimately hated language in existence. Complaints are not by lazy undergraduates, but by people who have used it extensively. A pretty famous example: http://yosefk.com/c++fqa/ Also, Linus Torvalds disallows it on his projects "just to keep the C++ guys out."

Name: Anonymous 2011-07-15 13:42

>>122
Yes, neglect all of your errors at runtime.

Name: Anonymous 2011-07-15 13:43

>>121
this.

Seriously just use C. Keep as much as possible in static arrays with small structs. Yeah it's a lot of statements and a lot of typing, but this is how optimization goes. Nobody said optimization was fun or interesting. Very very occasionally it is.

Name: Anonymous 2011-07-15 13:45

>>123
errors are fewer and easier to debug, provided you know what you're doing. You don't even need an IDE. Generally it's just pretty obvious as long as you have like a week or two of experience.

Name: Anonymous 2011-07-15 13:51

>>122
I'm not >>116, but just because you can't design things in C++ that are clean doesn't mean everyone has the same problem. I think you have a misconceived definition of "C++ style".

And yes, while GC isn't the cause of bad programming, it does enable a lot more bad programmers to scrape by. I've seen way more bad Java code than C++, where the Java developers were allocating lots of managed objects with huge memory footprints and creating complex object-graphs that would cause painful cache faults during traversal, leaving file handles open, etc. GC makes it easier for you to get by without thinking about how your data is laid out in memory, thus resulting in potentially less performance.

There are plenty of decent C++ programmers who enjoy the language. The problem is that it's always the haters who are the most vocal. This goes for any subject. In the end, your point is nothing more than argumentum ad populum and various other fallacies.

Name: Anonymous 2011-07-15 13:55

>>124
I'm >>121, I never said to just use C. I actually prefer using C++ to implement the design I mentioned, templates make your life easier, plus you get lambdas/closures which make using the STL algorithms or a algorithmic parallel patterns library like TBB, MPL or Fastflow much easier. The benefit of C++ is that you don't pay for what you don't use in C++, and templates have no overhead over manually hand-expanding the code, and lambdas/closures in C++11/C++0x are just fancy syntactic sugar for functor classes with a member operator() function, which is often less overhead than using a function pointer in C due to the compiler being able to inline the call.

Name: Anonymous 2011-07-15 13:58

And yes, while GC isn't the cause of bad programming, it does enable a lot more bad programmers to scrape by.

The biggest enabler of bad programmers scraping buy isn't GC but OOP, as popularized by C++ and especially Java. A guy can spend all day writing gettors and settors and design patterns that he doesn't understand and fool himself or others into thinking he's been doing work. It's got nothing to do with GC.

Name: Anonymous 2011-07-15 14:06

>>128
Yes and no. Yes OOP is the true source of the problems, but GC just compounds the problem when used with overly OO-techniques and abstractions.

Name: Anonymous 2011-07-15 15:39

This thread is the OOP faggot version of the "gc" thread.

Name: Anonymous 2011-07-15 16:06

>>129
the worst Java designs could be done easily in C++. In fact, they are usually perpetrated by guys coming from C++.

Name: Anonymous 2011-07-15 16:37

>>129
The original ``Design Patterns'' book had C++ and Smalltalk in it.

Name: Anonymous 2011-07-15 16:39

>>132
this is because single-dispatch is kind of flawed. It's not a big deal in Smalltalk though.

Name: Anonymous 2011-07-15 16:47

>>133
Smalltalk has blocks (and one of the most lightweight and nice syntax for them)

Name: Anonymous 2011-07-15 16:52

>>134
blocks are not multiple dispatch. They are nice, though.

Name: Anonymous 2011-07-15 16:54

>>135
Yes, but they add expressiveness. And are nicer than C++'s lambdas.

Name: Anonymous 2011-07-15 17:16

Sure is ObjC in here.

Name: Anonymous 2011-07-15 17:17

>>137
Sure is back to the imageboards in here.

Name: Anonymous 2011-07-16 4:02

>>137
ObjC is single-dispatch also.

fuck, people. come on.

Name: Anonymous 2011-07-16 4:41

>>113
Also Java's performance is due to the fact that it is its own virtual machine.
No, Java is slow because of its language semantics and horrible type system. For example, there are no user-defined value types, so even to return something simple like a Point2D requires an allocation. Type erasure means every time you pull any object out of a collection, you incur a costly type cast. All methods are virtual by default, so you must dynamically dispatch all calls. These things are slow.

I disagree. Your standards are not correct. Trust me -- I used to think the same thing. But shared references are the way. Good designs use them constantly.

Exhibit A: https://google-styleguide.googlecode.com/svn/trunk/cppguide.xml?showone=Smart_Pointers#Smart_Pointers

This is fucking GOOGLE. They probably have a billion lines of C++, and they are saying that shared counted references is bad design. (They recommend shared_ptr<> only go in containers, something that unique_ptr<> will finally make obsolete.)

Please, please don't use shared_ptr<>. Don't do it. Think about the ownership of your objects, for the good of the people who will maintain your code.

Name: Anonymous 2011-07-16 5:13

Mutable state considered harmful.

Name: Anonymous 2011-07-16 5:58

>>141
nice

Name: Anonymous 2011-07-16 5:59

>>141
You just mutated the state of this board's database, harmful faggot.

Name: Anonymous 2011-07-16 6:05

>>143
/prog/ is updated in a purely functional way, using the Shiichan monad.

Name: Anonymous 2011-07-16 6:21

ONE WORD: FORCED IMMUTABILITY OF THE STATE

Name: Anonymous 2011-07-16 11:24

>>140
shared references are bad C++ design. no argument about that.

C++ is bad design though. That is what I'm saying. It's really really simple. Let's take another feature that Lisp invented: real macros.

Technically in C++ it would be possible to build up a string and then compile it and then link your program to it. This would be a terrible idea in C++. But in Lisp you do the equivalent all the time and it's awesome.

Name: Anonymous 2011-07-16 11:28

>>140
No, Java is slow because of its language semantics and horrible type system.

performance is not about language semantics. It's about the ability to profile and take things native. Optimization is NOT something that should be taken on faith and put in the background and done prematurely. We have known this for decades.

The inability to see that starting most projects in C is *premature optimization* is something only someone who has never written anything other than C/C++ has. It's similar to the inability to see that C++ is flawed, brittle, and idiotic in its design.

Name: Anonymous 2011-07-16 19:50

>>147
performance is not about language semantics.
Uh actually, in this case it definitely is. Almost any non-trivial program converted from C++ to Java would run much slower, specifically because of Java's semantics.

No amount of optimization can get around the fact that pulling a float out of a Map is horribly, godawful slow in Java. The language semantics mean that the float had to be boxed into a Float and individually allocated from the heap, and it comes out of the Map as an Object (yes, even if you declared it Map<Float>), so the JVM has to verify that its class hierarchy extends/implements Float before you can finally pull the real fucking float out of it. There is no way to optimize it without hand-rolling your own primitive float map, and no way for the JVM to optimize it either.

The syntax of generics and autoboxing hides the semantics of what is actually going on.

Name: Anonymous 2011-07-16 20:44

>>148
but if Java could be easily embedded in C it would inherit C's performance. This is because bottlenecks are all that matter, and with easy embedding you can find and kill them.

Name: Anonymous 2011-07-16 20:45

>>149
embedded in C it would inherit the C compiler that happens to compile that C code's performance.

Name: Anonymous 2011-07-17 5:17

>>149
HIBT? this post is nonsensical. It's already effectively embedded in C because the JVM is written in C/C++. (actually HotSpot is half written in assembly, because fast GC is ridiculously hard to implement.)

Name: Anonymous 2011-07-17 6:18

If I write all my Python programs in C, is it still the forced indentation of code?

Name: Anonymous 2011-07-17 13:04

>>151
you are claiming that it is easy to use the JVM as an embedded library in a host C program.

you are retarded.

Name: Anonymous 2011-07-17 13:08

>>152

This is an important philosophical question that will go unanswered for generations.

Name: Anonymous 2011-07-17 13:08

ONE WORD: THE FORCED SEMICOLON TERMINATION OF THE CODE THREAD OVER!

Name: Anonymous 2011-07-17 14:53

Vala

Name: Anonymous 2011-07-25 19:10

Niggerlang

Name: Anonymous 2011-07-25 19:14

Ada

Name: Anonymous 2011-07-25 19:17

ONE WORD: THE FORCED CURLY BRACKETATION OF THE CODE THREAD OVER!

Name: Anonymous 2011-07-25 19:59

>>159
``But you're supposed to brace your code anyway!''

Name: Anonymous 2011-07-25 20:01

>>160
Fuck you I spit my beer on my keyboard.

Name: Anonymous 2011-07-25 20:01

>>11

GNU-C has thread local storage and atomic instructions.

Name: Anonymous 2011-07-26 3:24

Emperor Lockhart Atropos dastard sommelier flurry extoller Ypsilanti Sicily. Replete than.

Name: Anonymous 2011-07-26 3:26

Saskatchewan fungicide patio Jeffrey dour drone... Tabernacle.

Name: Anonymous 2011-07-26 3:32

>>39
Fifty? Minim. Uplift dialect De temporal.

Name: Anonymous 2011-07-26 3:34

Carbonate? Farad Lexington Moen hello warfare. Footprint inane tristate vault funeral spittle candle recess travesty?

Name: Anonymous 2011-07-26 3:41

>>32
Backtrack natty raillery snakeroot.

Name: Anonymous 2011-08-14 13:00

Has anyone tried Crack, the language?

Name: Anonymous 2011-08-14 14:40

I remember this thread.

( ≖‿≖)

Name: ( ≖‿≖) 2011-08-14 14:56

>>169
I remember it more.

Don't change these.
Name: Email:
Entire Thread Thread List