Dynamic language

H. S. Teoh hsteoh at quickfur.ath.cx
Thu Mar 15 20:15:57 PDT 2012


On Thu, Mar 15, 2012 at 09:50:30PM -0400, Nick Sabalausky wrote:
> "H. S. Teoh" <hsteoh at quickfur.ath.cx> wrote in message 
> news:mailman.730.1331851930.4860.digitalmars-d at puremagic.com...
[...]
> > Oh, I wasn't worried about the licensing part. It's more about
> > needing to ship dmd + druntime sources (and possibly some
> > game-specific .d libraries), plus optlink. Which is not horrible, I
> > suppose. But it feels a bit like buying a chair from IKEA and
> > getting a toolbox, a full set of tools, 5 boxes of nails of
> > different types, a power-drill, an engine replacement kit, and a
> > sledgehammer included in the box. :-)
> >
> 
> And a robot that actually uses all of those to build your chair for
> you, then cleans up, backs off and stays out of your way ;)

I, for one, am sure that I will enjoy the humour of watching a robot
assemble a chair with a sledgehammer. :-P


[...]
> > Actually, I like this idea. Don't ship the compiler/linker (which
> > feels like overkill), but user-generated scripts will be compiled by
> > an online server and sent back to the game as a DLL.
> >
> 
> To me, sending code off to a server to be compiled sounds like a
> bigger overkill ;) But, nonetheless, I think it could be a reasonable
> solution for targets on which the compiler won't actually run.

It's not so overkill if the game is running on a handheld with limited
resources. Wouldn't want to brick the device by eating up too much
memory during CTFE. ;-)


> Actually, what got me thinking about that is the Corona SDK (for
> iOS/Android development). One, umm...interesting...thing about it is
> that your code is *always* compiled on *their* servers. I felt that
> would be a major drawback for real professinal development: I wouldn't
> want to have to *rely* on them and their servers (and me having a good
> connection to them) just to compile *my* code.

Ugh. This one thing alone has convinced me to stay away from Corona at
all costs.


[...]
> Also, with the "on server" compiling, you could (at least in theory)
> do special checks for certain types of game exploits, security
> exploits, etc.  (Although, you could do that with a customized bundled
> compiler, too, but it'd be harder to enforce.)

Such checking would be practical for a custom scripting language with
limited expressiveness. A full-fledged Turing-complete language like D?
You're trying to solve the halting problem. Good luck.


[...]
> >> And all that would only matter for user-generated content. Any
> >> built-in scripts would naturally just already come pre-built. Hell,
> >> they could even come statically-linked if you wanted - develop them
> >> using the dynamic editing tools, and then statically link when
> >> you're ready to ship.
> >
> > I like this.
> >
> 
> Yea, me too, actually. :)  I'd love to give it a shot sometime. I just
> love the idea of getting what are admittedly very good benefits from
> the dynamic/interpreted world without having to give up the benefits
> of a static natively-compiled systems langauge. I'm a product of the
> 80's - I want it all, and to hell with making tradeoffs! ;)

This actually gives me another idea: the game can have an edit mode
where developers can create objects/scripts in-game, or even build an
entire game world from scratch, and all of it gets interpreted in
real-time so you can see the effects immediately and tweak accordingly.
These scripts and objects are saved somewhere as source code, and when
it comes time to ship, they get compiled and linked into the game
statically.

You could even pull a JIT this: add a new script/object, play around
with it in interpreted mode, and once it has stuck around for long
enough, the JIT compiler kicks in and turns it into native code.


[...]
> I guess what I really meant was: Suppose you're already using D to
> write, say, a PS3 or Android game, then naturally, at that point, your
> compiler would already be targeting that platform. So to move from
> *that* position to letting users mod the game, in-engine, in D,
> *without* sending the code off to some other computer, you would need
> two things:
> 
> 1. Some sort of dynamic-library-like ability on the given platform
> ('Course, this would be needed even for the "server compilation"
> method). I have no idea ATM how realistic this is on those platforms,
> though.
> 
> 2. Port the compiler to actually run on the given target machine.

Ahh I see.


> I'm no expert with the internals of DMD/LDC/GDC, but my suspision is
> that it would be much easier (at least the front-end anyway) than
> making a D compiler *target* a different CPU.

Perhaps. But the effort is still significant. GDC (well, GCC in
general), for example, requires a whole bunch of support libraries,
header files, and utilities (linker, assembler, etc.) to even be able to
compile anything. So to ship gdc as part of the game essentially means
shipping an entire development environment complete with library
headers, library files, a linker and assembler (and *their* respective
associated stuff). That's a pretty tall order just for being able to
compile game scripts on a handheld.


[...]
> Of course, that's not to say there aren't very good uses for external
> hosting. I have a Linode account (recently switched from a shared web
> host) and I *love* it.
[...]
> All that stuff is important if, like me, you're running some websites
> and your own email server.

Ahhahaha... so I'm not the only one. :-) I have a remote VPS too, and
it's very handy in our present still-stuck-in-ipv4 world for working
around silly limitations like NAT messing up direct connections to your
home PC, or your ISP blocking port 25 in a desperate effort to stop
spammers and spam zombies.


> But if you just want to be able to access your data/settings remotely,
> or share some files, what do you need a webhost, or Flickr, or
> Twitface, or iCloud for? (And for that matter, Twitface should be a
> protocol like torrent or Jabber, not a company and a private
> centralized service) The stuff's already on your computer or other
> device. Your computer or whatever is already connected to the
> internet. Boom, right there you should be done.  What's with all the
> middlemen worming their way in?

Exactly. That's why I never truly bought into the idea of the
much-touted "web applications" that store everything online in some
remote server somewhere beyond your control. I don't *trust* remote
servers I don't own. This is doubly important for things like GPG
private keys that you do not EVER want leaving your home PC in any way,
shape, or form.


[...]
> Heh :) Geek humour is awesome. That's part of why I like Futurama so
> much:
> 
> Bender (recalling a nightmare): Ones and zeroes everywhere! And I think I 
> saw a two!
> Fry: Don't worry, Bender. There's no such thing as two.
[...]

Aaaand my perl script pulls one of its funny coincidences, just for this
occasion:


T

-- 
GEEK = Gatherer of Extremely Enlightening Knowledge


More information about the Digitalmars-d mailing list