Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2001:
[Freeciv-Dev] Re: commandline syntax and semantics (was: Server/ruleset
Home

[Freeciv-Dev] Re: commandline syntax and semantics (was: Server/ruleset

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx (Freeciv developers)
Subject: [Freeciv-Dev] Re: commandline syntax and semantics (was: Server/ruleset unification)
From: Reinier Post <rp@xxxxxxxxxx>
Date: Mon, 1 Oct 2001 22:12:02 +0200

On Mon, Oct 01, 2001 at 09:14:22AM -0700, Arien Malec wrote:
> 
> --- Reinier Post <rp@xxxxxxxxxx> wrote:
> > On Sat, Sep 29, 2001 at 02:55:03PM -0700, Arien Malec wrote:
> > > Better to issue a create first:
> > > 
> > > create tech.railroad
> > > set tech.railroad.name "Railroad"
> > 
> > I cannot see what 'tech.railroad' would mean in the first line.
> > In my proposal it is the tech whose .name field matches /^railroad/i,
> > but the name is only assigned in the second line.
> 
> I believe that there are advantages to make the token "railroad" in
> "tech.railroad" an identifier, and not a name:
> 
> 1) It parses easily, whereas names need to be tech."Atomic Theory", 
> identifiers
> can only be tech.atomic_theory

Yes, but I presented a system for quoting that would be easy to parse:
quote by surrounding with " ", and make ""  stand for " within " "s.
You do have to keep track of whether you're within quotes or not.
It can be made obligatory to quote names.

> 2) See the following set of commands:
> 
> ; in the ruleset:
> create unit.archers

I still don't know what unit.archers is - a variable declaration
for the variable with the name 'archers' freely chosen by the user?
In that case using the . notation here is very confusing; declarations
are usually done like this:

  unit archers

> ; on the command-line, my semantics
> set unit.archers.name = "Bowmen"
> set unit.archers.hitpoints = ...
> 
> ; on the command-line, your sematics
> set unit.archers.name = "Bowmen"
> set unit.bowmen.hitpoints = ....
> ; Does unit.archers still exist now?

unit.archers doesn't identify anything now; the created object can
now be referred to as unit.bowmen, unless there was already a unit
with that name.

BTW the example is really about unit_types rather than units,
so my syntax would actually be:

  create units.archers  # automatically gets name "Archers" assigned
  set units.archers.name = "Bowmen"
  set units.bowmen.hitpoints = ...

and the mechanism is different: you introduce and use a variable name,
I do not.
 
> 3) (minor point) It lines up with how the current rulesets work:
> 
> [advance_atomic_theory]
> name = _("Atomic Theory")
> req1 = ...
> req2 = ...
> flags = ...
> 
> becomes
> 
> create tech.atomic_theory
> set tech.atomic_theory.name = ...
> set tech.atomic_theory.req1 = ...
>
> Or, in the multiple create/set syntax:
> 
> create tech.atomic_theory (
>   name = ...;
>   req1 = ...;
>   etc...
> )

With the latter syntax the identifier atomic_theory is superfluous,
unless there would be reason to retain the pointer for later use.
I don't think there is, so I really prefer the idea to use brackets only:

  create techs {
    name="Atomic Theory"
    req1= ...
    ...
  }

 or (because in my syntax the name field is special)

  create techs."Atomic Theory" {
    req1= ...
    ...
  }

Brackets can also be used (a la Pascal's WITH) to allow local
abbreviations for set commands:

  set techs."Atomic Theory" {
     req1= ...
     req2= ...
     name = "Atomic Enegry Technology"
  }

This way you don't need any variables at all.  The set and create
syntax is identical; the only difference would be that 'create'
requires the indicated object to be new, while 'set' requires it
to exist already.

> Arien

-- 
Reinier


[Prev in Thread] Current Thread [Next in Thread]