Hate: In love with C

General discussion about LÖVE, Lua, game development, puns, and unicorns.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Hate: In love with C

Post by bartbes » Sun May 31, 2009 11:41 am

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)

User avatar
appleide
Party member
Posts: 323
Joined: Fri Jun 27, 2008 2:50 pm

Re: Hate: In love with C

Post by appleide » Sun May 31, 2009 12:02 pm

C++, on the hand, I don't like. It's not even remotely as elegant as C or Lua.

User avatar
Xcmd
Party member
Posts: 211
Joined: Fri Feb 13, 2009 10:45 pm

Re: Hate: In love with C

Post by Xcmd » Sun May 31, 2009 12:07 pm

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.
We don't borrow, we don't read, we don't rent, we don't lease, we take the minds!

User avatar
sauer2
Citizen
Posts: 61
Joined: Tue Sep 02, 2008 4:15 pm

Re: Hate: In love with C

Post by sauer2 » Sun May 31, 2009 9:09 pm

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
Last edited by sauer2 on Mon Jun 01, 2009 11:19 am, edited 1 time in total.

User avatar
subrime
Citizen
Posts: 76
Joined: Thu Nov 13, 2008 6:18 pm
Location: Australia

Re: Hate: In love with C

Post by subrime » Mon Jun 01, 2009 7:32 am

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.

User avatar
appleide
Party member
Posts: 323
Joined: Fri Jun 27, 2008 2:50 pm

Re: Hate: In love with C

Post by appleide » Mon Jun 01, 2009 8:51 am

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 ...

User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Hate: In love with C

Post by bartbes » Mon Jun 01, 2009 8:53 am

FYI that's exactly what luatcc does.

User avatar
appleide
Party member
Posts: 323
Joined: Fri Jun 27, 2008 2:50 pm

Re: Hate: In love with C

Post by appleide » Wed Jun 03, 2009 11:02 am

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. :) )

fäbian
Prole
Posts: 6
Joined: Sat May 16, 2009 7:41 am

Re: Hate: In love with C

Post by fäbian » Wed Jun 03, 2009 8:45 pm

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.

User avatar
rude
Administrator
Posts: 1051
Joined: Mon Feb 04, 2008 3:58 pm
Location: Oslo, Norway

Re: Hate: In love with C

Post by rude » Thu Jun 04, 2009 12:15 pm

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.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests