Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Python has them:

    a = re.compile(r"""\d +  # the integral part
                       \.    # the decimal point
                       \d *  # some fractional digits""", re.X)


Coffeescript has similar functionality. From the Coffeescript docs:

    OPERATOR = /// ^ (
      ?: [-=]>             # function
       | [-+*/%<>&|^!?=]=  # compound assign / compare
       | >>>=?             # zero-fill right shift
       | ([-+:])\1         # doubles
       | ([&|<>])\2=?      # logic / shift
       | \?\.              # soak access
       | \.{2,3}           # range or splat
    ) ///
When turned into Javascript it becomes:

    var OPERATOR;
    
    OPERATOR = /^(?:[-=]>|[-+*\/%<>&|^!?=]=|>>>=?|([-+:])\1|([&|<>])\2=?|\?\.|\.{2,3})/;


yes, any decent PL nowadays has it, my point was that it should be the default.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: