The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Unexplored corners of Ruby's syntax

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Eigen Class

Posts: 358
Nickname: eigenclass
Registered: Oct, 2005

Eigenclass is a hardcore Ruby blog.
Unexplored corners of Ruby's syntax Posted: Mar 5, 2006 5:22 AM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Eigen Class.
Original Post: Unexplored corners of Ruby's syntax
Feed Title: Eigenclass
Feed URL: http://feeds.feedburner.com/eigenclass
Feed Description: Ruby stuff --- trying to stay away from triviality.
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Eigen Class
Latest Posts From Eigenclass

Advertisement

Xue Yong Zhi recently released rubyfront, which is already able to parse all the Ruby code included in the stable snapshot and the >70KLocs of Ruby on Rails (btw. things have changed a fair deal since that "riding a 1Kloc framework" talk). I've been providing some unusual syntax samples to chew on.

This is part of the activity in the Grammarians mailing list, where a bunch of courageous Rubyists*1 are struggling to build a stand-alone Ruby parser, while a few others (like me) throw ugly constructions at them.

Here are some of the things I found in the wild, loosely sorted so the most common come first (I could feed them to my lexical complexity estimator for Ruby, but that's too much work).

Naughty regexps

Seen in Getopt:

while self.sub!(/(^|\n)([^\t\n]*)(\t+)/sex) { |f|
 ...
}

%s literals

I hadn't seen that many before:

foo = %s'some symbol!($)!!'                        # => :"some symbol!($)!!"

Found in Borges.

_ separators after the decimal point

Seen in Extmath:

C = 0.577_215_664_901_532_861

rescue on non-constant expressions


Read more...

Read: Unexplored corners of Ruby's syntax

Topic: PLATFORM.deprecated Previous Topic   Next Topic Topic: Last month, in Ruby 1.9...

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use