Off-Topic: Quake II Ported to HTML5

I dunno about that. I mean, the whole reason we use typing at all is
so that we can keep things straight. The compiler is a computer
program with gigabytes of memory available. It can hold a whole lot
more details in its head at once than any human being, where we’re
restricted to “7 plus or minus 2”. If you throw away 90% of the type
signatures, what happens when someone else (or you, a year later)
comes back to it and tries to figure out what sort of data this code
is using?>----- Original Message ----

From: Brian Barrett <brian.ripoff at gmail.com>
Subject: Re: [SDL] Off-Topic: Quake II Ported to HTML5

I can’t wait until inferred typing becomes more popular in mainstream
languages. I mean useful inferred typing, where maybe 10% of the code
has explicit type signatures and the compiler deduces the rest from
use, not like the “var” keyword C# (though I don’t know if they’ve
extended this in more recent updates to the language).

That’s what I have in mind for EEL… It’s (relatively speaking) simple if you
specify types for function arguments and return values. Then the compiler only
has to know what the potential operator and function call results are, and it
can “fill in” the types for local variables.

The current OOP style (Lua style; using tables to hold members) is more
problematic. It could obviously be solved by adding a “real” struct/object
type, but I’m not sure I want to go down that route…On Wednesday 07 April 2010, at 15.34.19, Brian Barrett <brian.ripoff at gmail.com> wrote:

I can’t wait until inferred typing becomes more popular in mainstream
languages. I mean useful inferred typing, where maybe 10% of the code
has explicit type signatures and the compiler deduces the rest from
use, not like the “var” keyword C# (though I don’t know if they’ve
extended this in more recent updates to the language).


//David Olofson - Developer, Artist, Open Source Advocate

.— Games, examples, libraries, scripting, sound, music, graphics —.
| http://olofson.net http://kobodeluxe.com http://audiality.org |
| http://eel.olofson.net http://zeespace.net http://reologica.se |
’---------------------------------------------------------------------’

I love being able to make changes even when I’m really tired (sounds like a
bad idea, right?), or writing up whole subsystems without compiling until I
get my train of thought coded out. Then when I run the compiler, it points
out all of the little typos I made. Sometimes I rely on this heavily enough
that I feel lost and lonely when mixing things up and doing a little script
in Python. Of course, C++ error messages and suggestions are sometimes
(always?) cryptic or flat out wrong, so that’s where having type info
locally is a real benefit.

Jonny DOn Wed, Apr 7, 2010 at 6:47 AM, Mason Wheeler wrote:

I dunno about that. I mean, the whole reason we use typing at all is
so that we can keep things straight. The compiler is a computer
program with gigabytes of memory available. It can hold a whole lot
more details in its head at once than any human being, where we’re
restricted to “7 plus or minus 2”. If you throw away 90% of the type
signatures, what happens when someone else (or you, a year later)
comes back to it and tries to figure out what sort of data this code
is using?

----- Original Message ----
From: Brian Barrett <brian.ripoff at gmail.com>
Subject: Re: [SDL] Off-Topic: Quake II Ported to HTML5

I can’t wait until inferred typing becomes more popular in mainstream
languages. I mean useful inferred typing, where maybe 10% of the code
has explicit type signatures and the compiler deduces the rest from
use, not like the “var” keyword C# (though I don’t know if they’ve
extended this in more recent updates to the language).


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

[…inferred typing…]

If you throw away 90% of the type
signatures, what happens when someone else (or you, a year later)
comes back to it and tries to figure out what sort of data this code
is using?

Good point. And, what happens when you have full dynamic typing? You have to
dig even deeper to figure out what’s going on! :smiley:

(With the typed function arguments and returns I had in mind, you’d only have
to back up to the call/return level to find out what you have.)

Maybe explicit static typing (where “dynamic” would be one of the types
available) is just plain better… Like Jonathan points out in the other post,
compiler errors are very helpful. I’m actively trying to code in a way that
maximises the chances of the compiler trapping mistakes - but that doesn’t
work as well with EEL as it does with C and C++.

Now, with a VM with full dynamic typing, one could start by implementing
static typing in the compiler only, just to see how it works out from a
language design POV. :-)On Wednesday 07 April 2010, at 15.47.46, Mason Wheeler wrote:


//David Olofson - Developer, Artist, Open Source Advocate

.— Games, examples, libraries, scripting, sound, music, graphics —.
| http://olofson.net http://kobodeluxe.com http://audiality.org |
| http://eel.olofson.net http://zeespace.net http://reologica.se |
’---------------------------------------------------------------------’

There is where any dynamic language fan will tell you to write proper unit
tests.On Wed, Apr 7, 2010 at 3:47 PM, Mason Wheeler wrote:

I dunno about that. I mean, the whole reason we use typing at all is
so that we can keep things straight. The compiler is a computer
program with gigabytes of memory available. It can hold a whole lot
more details in its head at once than any human being, where we’re
restricted to “7 plus or minus 2”. If you throw away 90% of the type
signatures, what happens when someone else (or you, a year later)
comes back to it and tries to figure out what sort of data this code
is using?

----- Original Message ----
From: Brian Barrett <brian.ripoff at gmail.com>
Subject: Re: [SDL] Off-Topic: Quake II Ported to HTML5

I can’t wait until inferred typing becomes more popular in mainstream
languages. I mean useful inferred typing, where maybe 10% of the code
has explicit type signatures and the compiler deduces the rest from
use, not like the “var” keyword C# (though I don’t know if they’ve
extended this in more recent updates to the language).


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

…to manually verify what the compiler could check for you in a statically typed language? :stuck_out_tongue:

There is where any dynamic language fan will tell you to write proper unit tests.

I dunno about that. I mean, the whole reason we use typing at all isFrom: pjmlp@progtools.org (Paulo Pinto)
Subject: Re: [SDL] Off-Topic: Quake II Ported to HTML5
On Wed, Apr 7, 2010 at 3:47 PM, Mason Wheeler <@Mason_Wheeler> wrote:

so that we can keep things straight. The compiler is a computer
program with gigabytes of memory available. It can hold a whole lot
more details in its head at once than any human being, where we’re
restricted to “7 plus or minus 2”. If you throw away 90% of the type
signatures, what happens when someone else (or you, a year later)
comes back to it and tries to figure out what sort of data this code
is using?

Everyone would like to be writing the next Crysis, but only few
do. For many types of games you don't need
the low level access given by C, C++ or assembly languages.
True, but even in the casual games industry where you don't have
to count machine cycles the engines are written in C/C++. And
casual games are becoming more and more processor intensive with
all graphic effects so I doubt that high level languages will be
used in them besides to drive the low level engine.

Cheers,

Andre

That is happening already:

  • Do you want to target Zune devices, Windows 7 mobiles or Creators
    Club in XBox 360? XNA.
  • Do you want to develop games for the PSN Home? LUA
  • Do you want to develop games for Android, Blackberry, Blue Ray
    players, millions of mobile handsets out there? Java
  • Do you want to use the Unity games engine? .Net
  • Do you wan to use the latest version of the Unreal SDK? The new
    tools are WPF based
    (http://www.gamedev.net/columns/events/gdc2010/article.asp?id=1822)

  • Yes, but don’t all these drive the low level engine?

Some ARM processors even have the Jazelle execution state which directly
executes some Java instructions in hardware, so embedded Java is also
becoming low level if by “low level” we mean “close to the hardware.”

You see, the games industry moves very slowly in comparison with other
computing related industries, but it also moves.

Sure C/C++/Asm are not going away, but the amount of their usage
inside a game is decreasing. I am old enough to remember the same type
of discussion about C and Asm. In those days people would use C to
prototype, but real games would only use Asm (sounds familiar?).
I have to agree since nowadays some functionality is already using
scripting languages where C/Asm were used some years ago. What I don’t
agree is that the kernel of the engines will be written in higher level
languages.

The trend in processors to increase speed is to have multiple cores and
I don’t know a scripting language that takes full advantage of them. For
Cell processors the issue is even worse since the SPUs have only 256 KiB
of local memory and even Lua will have problems running moderately
complex programs with so little memory.

Me, I don’t really care. What is important is that the game is fun to
play, regardless how it was made.
Agreed, but the core gamers will always want the most realistic
graphics, AI, innovative gameplay etc. So the next Crysis’ core will be
written in C/C++/Asm.

Cheers,

AndreOn 07/04/2010 06:17, Paulo Pinto wrote:

On Wed, Apr 7, 2010 at 4:22 AM, Andre Leiradella <aleirade at sct.microlink.com.br <mailto:aleirade at sct.microlink.com.br>> wrote:


Paulo


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

In a way you are right, but even with static languages you should be writing
unit tests. Just because
it compiles, it doesn’t mean that it does what it is supposed to do.

Me personally I have my heart split among both types of languages. I also
prefer static typing, specially
functional languages and really enjoy the uprising of functional programming
that is happing nowadays in
the IT world.

But there are several use cases where dynamic languages provide better
solutions.

I would say to use the best tool for the Job.–
Paulo

On Wed, Apr 7, 2010 at 4:40 PM, Mason Wheeler wrote:

…to manually verify what the compiler could check for you in a statically
typed language? :stuck_out_tongue:

From: Paulo Pinto <@Paulo_Pinto>
**Subject: Re: [SDL] Off-Topic: Quake II Ported to HTML5

There is where any dynamic language fan will tell you to write proper unit
tests.

On Wed, Apr 7, 2010 at 3:47 PM, Mason Wheeler wrote:

I dunno about that. I mean, the whole reason we use typing at all is
so that we can keep things straight. The compiler is a computer
program with gigabytes of memory available. It can hold a whole lot
more details in its head at once than any human being, where we’re
restricted to “7 plus or minus 2”. If you throw away 90% of the type
signatures, what happens when someone else (or you, a year later)
comes back to it and tries to figure out what sort of data this code
is using?


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Agreed, but the core gamers will always want the most realistic graphics,
AI, innovative gameplay etc. So the next Crysis’ core will be written in
C/C++/Asm.

Cheers,

Andre

I also have to agree, but I would like that language not to be C or C++,
rather a higher level language that would allow you to go down to the metal
when needed, without many of the quirks that C++ has (note that I like C++).
Not sure if D or Go will ever be that language.

Cheers,
Paulo

In a way you are right, but even with static languages you should be writing unit tests. Just because
it compiles, it doesn’t mean that it does what it is supposed to do.

Oh, of course. I just find it a little silly to write tests specifically to do stuff a compiler ought to do for you because a compiler can’t. (Isn’t dynamic typing’s big selling point that it supposedly reduces the amount of work you need to do?)>From: Paulo Pinto

Subject: Re: [SDL] Off-Topic: Quake II Ported to HTML5

Are there competent validators for the popular dynamic languages?

Jonny DOn Wed, Apr 7, 2010 at 11:50 AM, Mason Wheeler wrote:

>From: Paulo Pinto
**>Subject: Re: [SDL] Off-Topic: Quake II Ported to HTML5

In a way you are right, but even with static languages you should be
writing unit tests. Just because
it compiles, it doesn’t mean that it does what it is supposed to do.

Oh, of course. I just find it a little silly to write tests specifically
to do stuff a compiler ought to do for you because a compiler can’t. (Isn’t
dynamic typing’s big selling point that it supposedly reduces the amount of
work you need to do?)


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

D is very promising, especially since Andrei Alexandrescu stepped up to the
plate. I’m still not sold, though, and it’s tough to get over the lame
connotation of the name of the language.

Jonny DOn Wed, Apr 7, 2010 at 11:47 AM, Paulo Pinto wrote:

Agreed, but the core gamers will always want the most realistic graphics,
AI, innovative gameplay etc. So the next Crysis’ core will be written in
C/C++/Asm.

Cheers,

Andre

I also have to agree, but I would like that language not to be C or C++,
rather a higher level language that would allow you to go down to the metal
when needed, without many of the quirks that C++ has (note that I like C++).
Not sure if D or Go will ever be that language.

Cheers,
Paulo


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Yes.

With dynamic languages it is very easy to manipulate XML files, database
records or do RPC calls, all thanks to metaprogramming.

This is also possible in C# 4.0 thanks to the new dynamic language support.
So there you get to do a bit of duck typing for such
use cases.

Granted, these are all use cases that are a bit away from games programming,
our focus here.On Wed, Apr 7, 2010 at 8:50 PM, Mason Wheeler wrote:

>From: Paulo Pinto <@Paulo_Pinto>
**>Subject: Re: [SDL] Off-Topic: Quake II Ported to HTML5

In a way you are right, but even with static languages you should be
writing unit tests. Just because
it compiles, it doesn’t mean that it does what it is supposed to do.

Oh, of course. I just find it a little silly to write tests specifically
to do stuff a compiler ought to do for you because a compiler can’t. (Isn’t
dynamic typing’s big selling point that it supposedly reduces the amount of
work you need to do?)


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

For Python,

PyLint – http://www.logilab.org/857
PyChecker – http://pychecker.sourceforge.net/On Wed, Apr 7, 2010 at 8:58 PM, Jonathan Dearborn wrote:

Are there competent validators for the popular dynamic languages?

Jonny D

On Wed, Apr 7, 2010 at 11:50 AM, Mason Wheeler wrote:

>From: Paulo Pinto <@Paulo_Pinto>
**>Subject: Re: [SDL] Off-Topic: Quake II Ported to HTML5

In a way you are right, but even with static languages you should be
writing unit tests. Just because
it compiles, it doesn’t mean that it does what it is supposed to do.

Oh, of course. I just find it a little silly to write tests specifically
to do stuff a compiler ought to do for you because a compiler can’t. (Isn’t
dynamic typing’s big selling point that it supposedly reduces the amount of
work you need to do?)


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

…so basically what I said way back this morning. Dynamic typing is very useful for serialization-related tasks, but not much else.>From: Paulo Pinto

Subject: Re: [SDL] Off-Topic: Quake II Ported to HTML5

With dynamic languages it is very easy to manipulate XML files, database records or do RPC calls, all thanks to >metaprogramming.

Mason Wheeler wrote:

Congratulations, you just discovered dynamic typing’s dirty little secret.
It looks really cool in a demo, but it turns out real code hardly uses it at all.
Data has a type and tends to stay that type far more often than not, so
why not formalize that and gain the benefits of compile-time type checking
and static analysis tools?

One thing several individuals who enjoy programming in ruby have
observed about the language is that it “stays out of your way”.

Reflecting on a couple decades of programming in C and about
half that for C++ , I still find it hard to pin down or quantify
precisely why i feel more productive in dynamic languages.

But I’d say that when a language really embraces its dynamicity,
the gestalt is more than just the narrow focus on type
declarations.

I wish I had an SDL example to offer, so this could be more on-
topic.

But here’s a database example, making use of an Object Relational
Mapping library called Og.

Almost ironically we are going to see some type declarations here,
as the database columns themselves will be typed:

class Address
property :name, String
property :company, String
property :dept, String
property :addr1, String
property :addr2, String
property :city, String
property :state, String
property :zip, String
property :country, String
belongs_to :order, Order
end

The above does an awful lot; I’ll try to be brief.

At compile time, we’re defining an ordinary ruby class called
Address ; however, also at compile time the “property” and
"belongs_to" methods are being executed and doing some work.

Neither the “property” nor “belongs_to” methods are part
of Ruby; they’ve been added by the Og library.

In ruby, there’s not a lot of distinction between compile-
time and run-time ; the full interpreter is available at all
times, and one can define or modify classes or methods at
any time.

This level of dynamicity may sound alarming, but I enjoyed
ruby’s designer, matz, likening it to trusting the programmer
to use dangerous tools:

| “open class” is so strong (often too strong), we can break things
| easily. In other word, Ruby trust you to give you sharp knives, where
| Python don’t. From the Python point of view, it’s wrong, I guess.

Anyway. At “compile-time” the statements in the Address class
above end up both defining methods in the class, as well as
linking the class into the Og library’s checklist of which
classes it will be managing as database tables.

When the Og library is then started up at “run-time”, like,
for example:

Og.start(
:destroy => false,
:evolve_schema => true,
:store => :postgresql,
:name => ‘database-name’,
:user => ‘db-user’
)

It will examine its checklist of classes like Address above,
which it knows about simply because such classes were encountered
at compile-time and invoked Og’s defining methods like
"property", and it will examine their structure and generate
the SQL / DDL necessary to realize the corresponding schema
in the database.

That’s already pretty dynamic, but we’re not done yet…

Og has also imbued any class it manages with some additional
on-the-fly run-time dynamicity.

For example, we can say:

records = Address.find_all_by_city_and_state(“Los Angeles”, “CA”)

records.each do |rec|
puts "#{rec.name} #{rec.company}"
end

Now, with Address.find_all_by_city_and_state, we’re calling
a “class method” on Address which didn’t even exist until now.

But, like Smalltalk (messageNotUnderstood), Ruby provides a
hook to handle messages sent to a class for which no existing
method can be found to respond to the message. (method_missing)

So, Og imbues its managed classes with a method_missing
implementation which looks at the method called, and if it
matches a pattern like /find_(all_)?by_(\w+)(_(and|or)(\w+))*/
will implement a method on the fly which performs the
requested search on the appropriate columns.

(And if the Og implementors chose, they could define said
method on the class, such that next time it was called, it
would execute directly as a method rather than virtually via
the method_missing hook.)

Powerful stuff. Could give more examples, but I hope this helps
illustrate that really dynamic languages offer a lot more power
than just a narrow focus on type declarations. (And we use it.)

Regards,

Bill

I don’t think it’s any great mystery. You’re comparing modern languages
with C (which barely more high level than assembly) and C++ (which is
powerful but incredibly arcane).

I’m sure that modern, simple, powerful statically typed programming
languages are possible. I’m not sure if any currently exist. (Java,
Delphi, C# and D don’t qualify, IMO.)On 4/7/2010 17:02, Bill Kelly wrote:

Reflecting on a couple decades of programming in C and about
half that for C++ , I still find it hard to pin down or quantify
precisely why i feel more productive in dynamic languages.


Rainer Deyke - rainerd at eldwood.com

Reflecting on a couple decades of programming in C and about
half that for C++ , I still find it hard to pin down or quantify
precisely why i feel more productive in dynamic languages.

I don’t think it’s any great mystery. You’re comparing modern languages
with C (which barely more high level than assembly) and C++ (which is
powerful but incredibly arcane).

I’m sure that modern, simple, powerful statically typed programming
languages are possible. I’m not sure if any currently exist. (Java,
Delphi, C# and D don’t qualify, IMO.)

I can’t say much about Java, C# or D, but why doesn’t Delphi qualify?
It’s statically typed, and from my perspective it’s quite modern, (at least
the recent versions are,) as powerful as C++ and as simple as VB. There
was only one thing in Bill’s “powerful Ruby features” that can’t be
implemented pretty easily in Delphi if you know enough about how the
object model works: adding new methods to a class at runtime. (And
I’ve actually been doing some research lately into how to accomplish
exactly that using scripting. It would probably take me a few months
to write the framework to make it work, but then it would be available.)>----- Original Message ----

From: Rainer Deyke
Subject: Re: [SDL] Off-Topic: Quake II Ported to HTML5
On 4/7/2010 17:02, Bill Kelly wrote:

[…]

Now, with Address.find_all_by_city_and_state, we’re calling
a “class method” on Address which didn’t even exist until now.

But, like Smalltalk (messageNotUnderstood), Ruby provides a
hook to handle messages sent to a class for which no existing
method can be found to respond to the message. (method_missing)

Now, that’s real interesting…!

In EEL, which has no “real” OOP support, I build objects from “tables”
(associative arrays), so it’s trivial to add methods and whatnot to instances
as needed. (Same design as Lua, basically.)

However, as it is, trying to read a non-existent index from a table throws an
exception, and that’s that. I suppose I could throw in a hook for
"XWRONGINGEX", so the constructor can wire that to a function that either
returns something handy, or re-throws the exception.

Speaking of examples, I could actually throw in some EEL examples for SDL -
but I’m not sure it would help the OT-ness of this thread much. ;-)On Thursday 08 April 2010, at 01.02.14, Bill Kelly wrote:


//David Olofson - Developer, Artist, Open Source Advocate

.— Games, examples, libraries, scripting, sound, music, graphics —.
| http://olofson.net http://kobodeluxe.com http://audiality.org |
| http://eel.olofson.net http://zeespace.net http://reologica.se |
’---------------------------------------------------------------------’

Rainer Deyke wrote:

Reflecting on a couple decades of programming in C and about
half that for C++ , I still find it hard to pin down or quantify
precisely why i feel more productive in dynamic languages.

I don’t think it’s any great mystery. You’re comparing modern languages
with C (which barely more high level than assembly) and C++ (which is
powerful but incredibly arcane).

What I mean is, my attempts at explaining this non-mystery rarely
have seemed to persuade anyone who is emotionally or philosophically
attached to static-typing-as-key-mechanism-to-catch-mistakes-at-
compile-time.

I’m sure that modern, simple, powerful statically typed programming
languages are possible. I’m not sure if any currently exist. (Java,
Delphi, C# and D don’t qualify, IMO.)

One of the lead developers of the JRuby interpreter posted about
an experimental language he was working on, which preserves the
ruby syntax, but adds optional static type hints for optimization
purposes: (The Fibonacci snippet at the top being the relevant
example)

http://kenai.com/projects/duby/pages/DubySamples

This sort of minimalist type hinting to assist the compiler in
optimizing critical routines, represents the sort of trade-off I
could probably embrace.

Whereas, cluttering a dynamic language across the board with
type declarations for the purpose of catching a certain category
of mistakes at compile time, is not a trade-off I would find
appealing.

(I grant the possibility that an appealing dynamic-but-statically-
typed language may theoretically exist, and that I simply have
not been exposed to its ideas.)

Regards,

Bill> On 4/7/2010 17:02, Bill Kelly wrote: