Page 2 of 6

Re: Hate: In love with C

Posted: Sun May 31, 2009 11:41 am
by bartbes
Yes C is awesome (especially C++).
rude wrote:Some of them I've never heard of.
Some? I've only heard of Freepascal, Scheme and Erlang, and that's just names, I have no idea what they are (though I do know lua is inspired by Scheme)

Re: Hate: In love with C

Posted: Sun May 31, 2009 12:02 pm
by appleide
C++, on the hand, I don't like. It's not even remotely as elegant as C or Lua.

Re: Hate: In love with C

Posted: Sun May 31, 2009 12:07 pm
by Xcmd
rude wrote:Whoa, whoa. I like C. C is awesome. :brows:

A lot of Ruby fans here, eh? I've never used it or seen any code. Read a bit about it just now and its semantics seems pretty nice, but its syntax will take some getting used to.

Xcmd: "gut Lua"? Blasphemy!
Sounded like that was your plan, sorry if I misunderstood. But I would absolutely love to see Ruby. Try Ruby in your browser if you really wanna fiddle with it (this is directed at anyone and everyone, not rude specifically): http://tryruby.hobix.com/
rude wrote:
sauer2 wrote: Vala, Seed7, Objektpascal (Gnu/Freepascal), Oberon, Modula3 ,Scheme, Eiffel ,Erlang
Wow. I've never used any of those. Some of them I've never heard of.
I've heard of all but Vala and Seed7. I've also heard of Yak, Forth, Pascal, Lisp, Perl, PHP and many others. I've personally sat down and used Pascal, Perl, PHP, Lua, BASIC (many many variations), Java, C, C++, C#, Objective C, Ruby, Python, HyperTalk and many others.

Re: Hate: In love with C

Posted: Sun May 31, 2009 9:09 pm
by sauer2
Wow. I've never used any of those. Some of them I've never heard of.
Let me explain:

-Vala is a Gnome project, its aims to bring proper object orientation to GObject. Its syntax should be similar like C# and Java.
The Vala compiler translates its code to C.
-Scheme is the second big lisp dialect.
-Erlang is a (interpreted?) script language used by telecomunication systems.
-Eiffel is try to make a sane OO language. :ultraglee:
-Object Pascal... ...is the object orientated, more powerful implementation of Pascal by Delphi and FPC, maybe also by GNU Pascal (not too sure).
-Modula 3 and Oberon are successors of Pascal. They are strong typing languages, syntax is similar to Pascal.

Referring to C: :shock:

C might be a good tool for realtime/hardware programming, but while pointers and other strange but efficient methods are good for those things, they suck because of their complexity and unreadability for rapid developement, game scripting and every day's programming.

C++ is imo a bloated oo version of C, but it still doesn't have the improvements from C99. It may take years, until the compilers implement the coming, improved C++ standard.

So it is up to your decision and i don't want to bother you with this neither stop you from programming this, but i think, there are reasons someone shouldn't use C for all tasks.

EDIT: All in all, i guess it would be cool for programmers of the above named languages to find out, that their knowledge has another use. That's the reason for suggesting them. :neko:

best regards,

Sauer2

EDIT2: http://seed7.sourceforge.net/faq.htm

Re: Hate: In love with C

Posted: Mon Jun 01, 2009 7:32 am
by subrime
So how's this for a messed up idea... something of a love-hate relationship:

integrate the tcc code into the love ensemble to allow on-the-fly compilation of lua modules written in c.

Code: Select all

mymodule=love.build('myluamodle.c')
require mymodule
The point? If you have a part of your project that is time critical (and you have the c skillz) you could use this to put select parts into c in a dynamic and relatively platform independent way.

Of course, almost all the lua modules I've written are just wrapping an external library for png, threading, etc and that kind of use doesn't really fit the love/portability model so I can't see myself actually using this kind of feature/bug.

Re: Hate: In love with C

Posted: Mon Jun 01, 2009 8:51 am
by appleide
Write a tool that reads each C function you wrote and generate C binding code. =D Basically just need to determine argument and return types ...

Re: Hate: In love with C

Posted: Mon Jun 01, 2009 8:53 am
by bartbes
FYI that's exactly what luatcc does.

Re: Hate: In love with C

Posted: Wed Jun 03, 2009 11:02 am
by appleide
bartbes wrote:FYI that's exactly what luatcc does.
Hmm, if we can optionally use C in our love projects that'd be great! :) So I can implement my pushMatrix, popMatrix, transform functions in C instead and it'll be faster!

(Or we could just bind those functions too, but thats for another day, the point is, we can re-write bottleneck lua code in C and speed things up. :) )

Re: Hate: In love with C

Posted: Wed Jun 03, 2009 8:45 pm
by fäbian
sauer2 wrote:-Erlang is a (interpreted?) script language used by telecomunication systems.
Erlang is compiled to byte code and runs on a virtual machine, like lua. There is a native code compiler as well (HiPE) which transparently runs native code. It's a general purpose programming language with quite wonderful concurrency programming properties.

Re: Hate: In love with C

Posted: Thu Jun 04, 2009 12:15 pm
by rude
appleide wrote:C++, on the hand, I don't like. It's not even remotely as elegant as C or Lua.
I know what you mean. C++ can seem like an inharmonious clusterfuck of paradigms. However, inheritance is critical (in LÖVE), and I would hate to implement that in pure C (I've seen it. It's not pretty).
appleide wrote:Hmm, if we can optionally use C in our love projects that'd be great!
Keep the champagne unpopped for now. We might be able to use some gimped version of C, but we will not be able to access rendering functions (for instance from OpenGL), nor functions in love.graphics, love.audio, etc.

Here is what I would like to see:

Code: Select all

vb = love.graphics.newVertexBuffer( ... )

code = [[
int updatevb(lua_State * L)
{
	lovec_vertex * vb = (lovec_vertex *)lua_tolightuserdata(L, 1);
	int size = lua_tointeger(L, 2);
	float dt = (float)lua_tonumber(L, 3)
	
	/* Do fast things to vertex buffer */

	return 0;
}
]]

love.native.compile(code)

updatevb = love.native.getSymbol("updatevb")

-- In update:
updatevb(vb:cptr(), vb:size(), dt)

-- In draw:
love.graphics.draw(vb, ... )

That should be pretty fast.