Greetings,

This is an RFC on one aspect of my Muldis D language.  It only concerns the
PTMD_STD (normal) dialect of Muldis D.  While Muldis D is designed that one can
make other dialects easily enough that look like anything they want, while still
parsing into the same "actual Muldis D code as system catalog", I prefer for the
standard dialect to be the most welcoming in the first place.

I wanted to let you know that I plan ASAP to enhance the PTMD_STD (normal)
dialect of Muldis D to be more friendly to people who like programming languages
without sigils, so further towards Python/C/SQL/etc and from Perl/etc.

Specifically, I'm going to make the "data sigil" ("$") lexical element optional,
but still enforcing consistency such that within the scope of a single code file
you must either use or not use the "data sigil" everywhere; no mix-and-match,
which is worse than all or none.  The "data sigil" is used in the names of
routine parameters, type attributes, lexical and global variables, and routine
named expression nodes.  It has no meaning other than "this holds data".

Generally speaking, Muldis D has no need for such sigils in order to interpret
code, although they make things slightly easier.  Mainly I included the "$"
everywhere I did because *I* think it makes the code more readable, quickly
identifying at a glance what is a variable/etc versus what isn't.  But I also
find code without the $ to be sufficiently readable also.

To help interpret PTMD_STD code, the use or nonuse of the data sigil must be
explicitly declared at the top of the file as part of the "extensions" section
of the language name.  For example, it would contain "uses_data_sigil => False"
or "uses_data_sigil => True".

In any event, the $ is simply a dialect element and the actual entity name
doesn't include the $.

At the bottom of the page http://muldis.com/Muldis_D.html is a "hello world"
program in its original form that uses data sigils; here is the primary part of
the same program without the $s; it is identical but no $ characters:

    procedure main () [
        # This is the program's main procedure. #
        write_Text_line( 'Hello!' )
        var people : Relation
        { people := Relation:{ name, addr } }
        var name : Text
        var addr : Text
        var msg : Text

        write_Text_line( 'First add some info.  Enter blank line when done.' )
        |gather_person ::= loop [
            # Gathers person info from user. #
            prompt_Text_line( &name, 'Enter a person\as name: ' )
            given name when '' leave |gather_person
            prompt_Text_line( &addr, 'Enter that person\as address: ' )
            given addr when '' leave |gather_person
            # Adds a person to our db of people. #
            assign_insertion( &people, Tuple:{ >name, >addr } )
        ]

        write_Text_line( 'Now search for info.  Enter blank line when done.' )
        |lookup_person ::= loop [
            prompt_Text_line( &name, 'Enter a name to search for: ' )
            given name when '' leave |lookup_person
            {
                # Look up person by name, get their address. #
                matched_people ::= people matching Relation:{ { >name } }
                msg := given r# matched_people
                    when 0 then 'No person matched'
                    when 1 then 'Found address for that person is: '
                        ~ (t matched_people).addr
                    default 'More than one person matched'
            }
            write_Text_line( msg )
        ]

        write_Text_line( 'Goodbye!' )
    ]

A code file without sigils would have a language declaration like this:

    Muldis_D:"http://muldis.com":0.130.0:PTMD_STD:{
        catalog_abstraction_level => rtn_inv_alt_syn,
        op_char_repertoire => basic,
        uses_data_sigil => False
    }

... while one using sigils would say "True" instead of "False".  Specifying that
pragma name and value is mandatory, since there is no reasonable default answer.

Now, I figure that this change should have almost no impact on how easy it is to
parse Muldis D code, and in fact I'd probably just have to change not more than
a half-dozen lines in the grammar definition to provide the option.

The main downside I see of not requiring the $ is that there is more risk of
conflict between language keywords and variable/etc names used as barewords,
since user entities may be named anything at all; however, since all entity
names can be delimited with double-quotes (like in SQL), users can quote any
otherwise-bareword names to clarify that they are not keywords, in the
appropriate circumstances; so `foo`, `$foo`, `"foo"`, `$"foo"` all refer to the
variable/etc named "foo".

So, do you have any feedback on this change?  Does this option make the language
better or worse in your eyes?  (I'll take silence as acceptance of the change.)

Also, are there any other grammar changes you would consider important for the
PTMD_STD dialect, say to make it more like your favorite other languages?

Thank you in advance.

-- Darren Duncan

_______________________________________________
muldis-db-users mailing list
muldis-db-users@mm.darrenduncan.net
http://mm.darrenduncan.net/mailman/listinfo/muldis-db-users

Reply via email to