Phantasmal MUD Lib for DGD

Phantasmal Site
Phantasmal API
Archive
DGD
Getting DGD
Game Design Issues
The Kernel Library
LPC
Writing a Library
Changing LPC
Object Cleanup
⁄cmd vs wiztool
Conditional Inheritance
Object Database
Distribute a State Dump?
Designing Driver Objs
FTPD
GurbaLib
HTTPD
State Dumps
Heaven7
InterMUD3
Interrupt Call
Designing AUTO Objs
Misc Issues
NFS
Object Binding
Object Management
Other Net Services
Persistent MUDLibs
Player vs Body
Precompiling
Reimplementing From Scratch
Releasing Code
Rlimits
Script Delays
Misc Security
Outgoing Email
So You Want To...
Start from Scratch?
Supplementary Documentation
Telnet Protocol
Using the Kernel
Using Melville
Using Phantasmal
WebDAV
Which License
What Does It Do?
DGD LPC Reference
Running a MUD
Skotos
CSharp vs DGD
Contributing to DGD
DGD Glossary
Java vs DGD
DGD MUDs
Miscellaneous DGD
MudOS vs DGD
Slush Bucket
Why Use DGD?
Design
Development
Innsmouth MUD
Phantasmal Operation
Setup
Test module index
Phantasmal Tutorials
Comparison to Other Libs
Credits
Current Features
History
Installing Baseline Phantasmal
About

Can You Modify LPC as DGD Understands It?


From: dgd@dworkin.nl (Par Winzell)
Date: Tue May  3 16:32:01 2005
Subject: [DGD] Question: Implementing foreach()

[...]

So if a sane foreach design relies on specific mudlib classes, then
obviously the foreach implementation itself should be in the mudlib. To
do this, as Noah says, means you take over compile_object() and do your
own pass over the source code before you hand it over to DGD's compiler.
At that point you could (if you still cared enough) expand e.g.

  foreach (item : player->query_inventory()) {
      item->explode();
  }

to something like

  {
    object "/lib/iterator" __tmpiter345;
    __tmpiter345 = player->query_inventory()->get_safe_iterator();
    while (__tmpiter345->has_more()) {
      item = __tmpiter345->get_next();
      item->explode();
    }
  }


My personal opinion is increasingly that it's better to resist the lure
of syntactic sugar. Verbose code is not necessarily less readable, and
once you start modifying LPC, it's incredibly hard to resist bloating
the language.

Zell