[#69084] [Ruby trunk - Feature #11124] [Open] [PATCH] lib/*: use monotonic clock for timeouts — normalperson@...
Issue #11124 has been reported by Eric Wong.
5 messages
2015/05/06
[#69138] [Ruby trunk - Feature #11136] [PATCH] webrick: avoid fcntl module — nobu@...
Issue #11136 has been updated by Nobuyoshi Nakada.
3 messages
2015/05/12
[#69160] [Ruby trunk - Feature #11146] [PATCH] variable.c: initialize generic_iv_tbl at start — nobu@...
Issue #11146 has been updated by Nobuyoshi Nakada.
4 messages
2015/05/13
[#69175] Re: [Ruby trunk - Feature #11146] [PATCH] variable.c: initialize generic_iv_tbl at start
— Eric Wong <normalperson@...>
2015/05/13
nobu@ruby-lang.org wrote:
[ruby-core:69370] [Ruby trunk - Feature #11181] Add a line directive to Ruby
From:
gam3-ruby@...3.net
Date:
2015-05-26 21:30:43 UTC
List:
ruby-core #69370
Issue #11181 has been updated by Allen Morris.
Reason why 'eval "string", b, file, line' cann't be used in place of line directive.
Use case: Input file looks like
file: alice
<alice>=
puts "'#{__FILE__} #{__LINE__}'" # alice line 2
<bob>
puts "'#{__FILE__} #{__LINE__}'" # alice line 4
file: bob
<bob>=
puts "'#{__FILE__} #{__LINE__}'" # bob line 2
<charlie>
puts "'#{__FILE__} #{__LINE__}'" # bob line 4
file: charly
<charlie>=
puts "'#{__FILE__} #{__LINE__}'" # charlie line 2
Some buildy thingy is run on this that reads all three files and used ''\<alice>' as the start and generate something like:
eval <<-'RUBY', nil, 'alice', 1
puts "'#{__FILE__} #{__LINE__}' = 'alice 2'"
eval <<-'RUBY2', nil, 'bob', 1
puts "'#{__FILE__} #{__LINE__}' = 'bob 2'"
eval <<-'RUBY3', nil, 'charlie', 1
puts "'#{__FILE__} #{__LINE__}' = 'charlie 2'"
RUBY3
puts "'#{__FILE__} #{__LINE__}' != 'bob 4'" # ERROR: displays as 'bob 5'
RUBY2
puts "'#{__FILE__} #{__LINE__}' != 'alice 4'" # ERROR: displays as 'alice 9'
RUBY
Then there is the less likeley case where you have non-complete 'code blocks'. This would be where
we (for some odd reseason) wanted to have the start of a block in one file and the end in another:
file a = "class Bob"
file b = "end # class Bob"
#line 1 "a"
class bob
#line 1 "b"
end # class Bob
----------------------------------------
Feature #11181: Add a line directive to Ruby
https://bugs.ruby-lang.org/issues/11181#change-52644
* Author: Allen Morris
* Status: Open
* Priority: Low
* Assignee: ruby-core
----------------------------------------
Add a __line directive__ to Ruby
```
#line {nn} ["filename"]
```
This is done by creating a array of filenames and using the upper bits of the line_number to determine the current filename. The original filename is in position 0.
An extra node is added by the parser that informs the compiler of the filenames so the backtrace code can also use the correct file names.
The __\_\_LINE____ and __\_\_FILE____ _constants_ are updated and compile time warnings are also effected.
There is a pull request at https://github.com/ruby/ruby/pull/910
The patch does not have any affect on current programs unless a line matching '#\s*line \d+(\s+"(.*)")?\s*$' is found in the ruby source code.
More tests need to be written before this change sould be applied.
Use case:
This is helpful for debugging any generated code but is particularlly helpful for literate programming using Noweb.
--
https://bugs.ruby-lang.org/