On Thu, Jun 17, 2010 at 2:44 PM, Darren Duncan <dar...@darrenduncan.net>wrote:
> > > 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. > what motivated this decision? did a lot of people make this request of you? > > Specifically, I'm going to make the "data sigil" ("$") lexical element > optional, > typically when language elements are optional it enhances readability: my %val = (a => 1, b => 2); # no quotes needed for 'a' and 'b' > 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, > I dont really like this idea of trying to have two different syntaxes like that for a single dialect, even if you can change it with a config option such as you have showed. > 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. right, so since it makes it more readable, who/what suggested otherwise? > > > 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; To me, $ implies 'var' so why not just: $name : Text $addr : Text > 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 } } > it seems overly verbose to have two lines for this... could you not have done: var 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 } } > This ">" sign confuses me (of course I havent read the spec), but I immediately think of greater-than name without knowing more about this language. > 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". > that spells confusion if you ask me.