Page 2 of 6 FirstFirst 1 2 3 4 ... LastLast
Results 11 to 20 of 58

Thread: Map literals in ASH (potential feature)

  1. #11
    Senior Member Winterbay's Avatar
    Join Date
    Feb 2010
    Posts
    5,033

    Default

    You can have a float called int? That'll never be confusing
    My scripts:
    Best sushi for Profit
    Winterbay's Helpful Automatic Monsterbasher (WHAM)

    Scripts maintained by me:
    Autobasement
    Smashlib

    A small programmer joke:
    Wife: Honey, please go to the market and buy 1 bottle of milk. If they have eggs, bring 6.
    The man came back with 6 bottles of milk.
    Wife: Why did you buy 6 bottles of milk.
    Man: Because they had eggs...

    The 6 Stages of Debugging: 1 )That can't happen. 2) That shouldn't happen. 3) Hmmm, weird. 4) Why does that happen? 5) Oh, I see. 6 )How did that ever work?

    All programs can be optimized, and all programs have bugs; therefore all programs can be optimized to one line that doesn’t work. /Bob Fitch, Blizzard

  2. #12
    Senior Member
    Join Date
    Mar 2012
    Posts
    246

    Default

    Yeah, internal types and functions should have been reserved keywords.

  3. #13
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    11,078

    Default

    You can have a float called int? That'll never be confusing
    Originally Posted by Winterbay View Post
    Nope. Internal types are reserved keywords.

    Yeah, internal types and functions should have been reserved keywords.
    Originally Posted by rlbond86 View Post
    You didn't try it out before making this statement, did you? Pity.

    Function names, built-in or user-defined, are not reserved keywords, since there is no ambiguity in a name used as a variable and a name used as a function.

    I assume that user defined types - typedefs and record names - are not precluded from being variable or function names. By analogy with the built-in types, presumably they should be.
    Ph'nglui mglw'nafh Cthulhu
    R'lyeh wgah-nagl fhtagn.

  4. #14
    Developer
    Join Date
    Aug 2009
    Posts
    2,664

    Default

    Evidently "item" and "effect" were not reserved. At least, one of the scripts I was using had those as variable names. That was the entire basis of my statement; I apologize for not making that more evident.

    edit: rather, this happens when it's the key of a foreach loop? I'm not entirely sure what the triggers are.

    Edit: demonstrated via the following:
    Code:
     > ash boolean[int] a = $ints[1,2,3]; foreach item in a { print(item);}
    1
    2
    3
    Returned: void
    Might have a patch up soon. For now, I'll file a bug report (perhaps with patch when/if I write one).
    Last edited by heeheehee; 08-09-2012 at 08:54 PM.

  5. #15
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    11,078

    Default

    Code:
    		reservedWords.add( "item" );
    		...
    		reservedWords.add( "effect" );
    So, perhaps the bug is that foreach is not enforcing that.

    Edit: Yes. Revision 11386 fixes that.
    Last edited by Veracity; 08-09-2012 at 08:57 PM.
    Ph'nglui mglw'nafh Cthulhu
    R'lyeh wgah-nagl fhtagn.

  6. #16
    Minion Bale's Avatar
    Join Date
    Jun 2008
    Posts
    13,263

    Default

    You broke BatBrain! Serves zarqon right for using a keyword in a foreach.
    If people like my scripts, please send me stuffed Hodgmen.
    Universal Recovery, OCD Inventory Control, CounterChecker, newLife, ChIT.


  7. #17
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    11,078

    Default

    It was always intended to be a bug. Too bad we didn't enforce it until now!
    Ph'nglui mglw'nafh Cthulhu
    R'lyeh wgah-nagl fhtagn.

  8. #18
    Minion Bale's Avatar
    Join Date
    Jun 2008
    Posts
    13,263

    Default

    Well, of course it was always intended to be a bug. I was always careful not to use keywords. foreach ty,in,rec in factors is obviously dumb since he's using "in" as a keyword and a variable in the same statement. Though knowing zarqon, he might have done that on purpose just to get away with it. He and good programming practice enjoy waving to each other as they pass in opposite directions.
    If people like my scripts, please send me stuffed Hodgmen.
    Universal Recovery, OCD Inventory Control, CounterChecker, newLife, ChIT.


  9. #19
    Senior Member
    Join Date
    Jul 2007
    Posts
    1,193

    Default

    He and good programming practice enjoy waving to each other as they pass in opposite directions.
    Originally Posted by Bale View Post
    I lol'd.
    Procrastination
    Leaves many things unfinished

    Originally Posted by /haiku

  10. #20
    Senior Member zarqon's Avatar
    Join Date
    Nov 2007
    Location
    Seoul, Korea
    Posts
    3,434

    Default

    That was an oversight, not me being idiosyncratic. I was just abbreviating the words "type", "int", and "record", since using their full forms as key variables would -- obviously -- be stupid.
    Sig by JakAtk
    My scripts: One-Click Wossname | Om******t (??) | Psychose-a-Matic | RandBot
    Combat suite: Best Between Battle | Mer********d (?!) | SmartStasis | BatMan | BatMan RE
    For script authors: ASH Wiki | ZLib | BatBrain | CLI Links | CanAdv | Script Registry | Map Manager | About Bats
    If you appreciate my work, help me become BAT KING OF THE WORLD! Thanks to all donators!

Similar Threads

  1. flyeredML - potential rounding problem
    By Magus_Prime in forum Scripting Discussion
    Replies: 40
    Last Post: 02-17-2015, 12:38 PM
  2. Map literals
    By shademaster00 in forum Scripting Discussion
    Replies: 4
    Last Post: 02-12-2012, 04:43 PM
  3. 10018: Tweak ScriptMRUList for potential reuse.
    By RSS Bot in forum Latest SVN Changes
    Replies: 0
    Last Post: 11-21-2011, 04:40 PM
  4. set_auto_attack() – Potential bug?
    By Banana Lord in forum Community Support
    Replies: 4
    Last Post: 06-14-2011, 05:51 AM
  5. Feature Potential Earnings (actual)
    By NardoLoopa in forum Bug Reports
    Replies: 9
    Last Post: 09-07-2010, 07:26 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •