# orderedItems[].object.content
But it looks like I'll need to invoke some black magic (e.g. using a C extension or fiddle) to get access to locals captured by a define_method block, e.g:

re = dynamically_generated_regexp
define_method(:bar) {|baz| foo.match? baz }

I'd hoped they'd be accessible like they are on Proc, via `method.binding` or `method.to_proc.binding`.

# orderedItems[].object.contentMap.en
But it looks like I'll need to invoke some black magic (e.g. using a C extension or fiddle) to get access to locals captured by a define_method block, e.g:

re = dynamically_generated_regexp
define_method(:bar) {|baz| foo.match? baz }

I'd hoped they'd be accessible like they are on Proc, via `method.binding` or `method.to_proc.binding`.

# orderedItems[].object.content
I wrote a simple thing to collect most of the regexps defined in a module, to test them with ruby 3.2's `Regexp.linear_time?`. This could be useful for finding and preventing ReDoS vulnerabilities. In addition to consts it finds hard-coded regexp literals in method defs, even when dynamically defined with eval.
https://github.com/ruby/net-imap/blob/master/test/net/imap/regexp_collector.rb

# orderedItems[].object.contentMap.en
I wrote a simple thing to collect most of the regexps defined in a module, to test them with ruby 3.2's `Regexp.linear_time?`. This could be useful for finding and preventing ReDoS vulnerabilities. In addition to consts it finds hard-coded regexp literals in method defs, even when dynamically defined with eval.
https://github.com/ruby/net-imap/blob/master/test/net/imap/regexp_collector.rb

# orderedItems[].object.content
@joeldrapper Whether or not that makes it into ruby, it works very well in your use case IMO. I occasionally use refinements for code like that, where it makes code easier to read in the local use case. E.g, this Regexp#- refinement https://github.com/ruby/net-imap/blob/e5aeeb01e29357267da67e6a4f04ef32e2e0db2f/lib/net/imap/response_parser.rb#L63-L68 wouldn't be the right implementation for stdlib, but it works well here, IMO.

# orderedItems[].object.contentMap.en
@joeldrapper Whether or not that makes it into ruby, it works very well in your use case IMO. I occasionally use refinements for code like that, where it makes code easier to read in the local use case. E.g, this Regexp#- refinement https://github.com/ruby/net-imap/blob/e5aeeb01e29357267da67e6a4f04ef32e2e0db2f/lib/net/imap/response_parser.rb#L63-L68 wouldn't be the right implementation for stdlib, but it works well here, IMO.

# orderedItems[].object.content
@noelrap @sparker However modern irb's tab-completion menu make the "alternate input method" unnecessary. That makes debugging🔍 more usable (yay), but also extremely_dangerous💣 (oh well).

# orderedItems[].object.contentMap.en
@noelrap @sparker However modern irb's tab-completion menu make the "alternate input method" unnecessary. That makes debugging🔍 more usable (yay), but also extremely_dangerous💣 (oh well).

# orderedItems[].object.content
@noelrap @sparker
Since it makes me smile to read it, but I've been reluctant to use in production code, how about for special circumstances code that you want people to think twice about using... force them to copy/paste or use an alternate input method:

def experimental🧪 = :incomplete_spikes_and_hacks
def debugging🔍 = :inspecting_internal_details
def extremely_dangerous💣 = someone set up us the 💣

# orderedItems[].object.contentMap.en
@noelrap @sparker
Since it makes me smile to read it, but I've been reluctant to use in production code, how about for special circumstances code that you want people to think twice about using... force them to copy/paste or use an alternate input method:

def experimental🧪 = :incomplete_spikes_and_hacks
def debugging🔍 = :inspecting_internal_details
def extremely_dangerous💣 = someone set up us the 💣

# orderedItems[].object.content
@swindsor @noelrap it's a perfectly valid ruby identifier. _any_ non-ASCII chars will work.
irb(main):001:0> def foo‽ = :bar‽
=> :foo‽
irb(main):002:0> foo‽
=> :bar‽

But... none of the recommended constrains in https://unicode.org/reports/tr31/ are implemented. Wanna be evil and use U+2063 (Invisible Separator)?

irb(main):004:0> :foo == :foo⁣
=> false

# orderedItems[].object.contentMap.en
@swindsor @noelrap it's a perfectly valid ruby identifier. _any_ non-ASCII chars will work.
irb(main):001:0> def foo‽ = :bar‽
=> :foo‽
irb(main):002:0> foo‽
=> :bar‽

But... none of the recommended constrains in https://unicode.org/reports/tr31/ are implemented. Wanna be evil and use U+2063 (Invisible Separator)?

irb(main):004:0> :foo == :foo⁣
=> false

# orderedItems[].object.content
@sparker @noelrap I've occasionally considered using emoji in identifiers in production code... but so far I've resisted that temptation... so far 😜

# orderedItems[].object.contentMap.en
@sparker @noelrap I've occasionally considered using emoji in identifiers in production code... but so far I've resisted that temptation... so far 😜

# orderedItems[].object.content
@sparker @noelrap snowman is a valid identchar!

from parse.c, is_identchar: rb_enc_isalnum((unsigned char)*ptr, enc) || *ptr == '_' || !ISASCII(*ptr);

irb(main):001:0> def 😉(☃️ ) = puts ☃️
=> :😉
irb(main):002:0> 😉 "hello world"
hello world

# orderedItems[].object.contentMap.en
@sparker @noelrap snowman is a valid identchar!

from parse.c, is_identchar: rb_enc_isalnum((unsigned char)*ptr, enc) || *ptr == '_' || !ISASCII(*ptr);

irb(main):001:0> def 😉(☃️ ) = puts ☃️
=> :😉
irb(main):002:0> 😉 "hello world"
hello world

# orderedItems[].object.content
@olleolleolle I noticed this yesterday. Big release and big news! But I haven't looked into why the dependabot branch build is failing yet... :)

# orderedItems[].object.contentMap.en
@olleolleolle I noticed this yesterday. Big release and big news! But I haven't looked into why the dependabot branch build is failing yet... :)

# orderedItems[].object.content
@tenderlove @headius for what it's worth, I had a little bit of spare time so I just hacked this "nameprep" implementation in termux on my phone (no tests, no punycode, etc): https://github.com/ruby/net-imap/pull/83/files

# orderedItems[].object.contentMap.en
@tenderlove @headius for what it's worth, I had a little bit of spare time so I just hacked this "nameprep" implementation in termux on my phone (no tests, no punycode, etc): https://github.com/ruby/net-imap/pull/83/files

# orderedItems[].object.content
@tenderlove @headius I only really needed it for SASL (SCRAM-* and ANONYMOUS), so I stopped after implementing the `saslprep` and `trace` profiles. By my count, there are at least three (incomplete) SASL implementations in stdlib and another half dozen in various gems, which... kinda defeats the purpose of SASL. After I finish my net-imap SASL updates, I hope to port to net-smtp and net-pop.

It would be nice if the stringprep bits found wider applicability too.

# orderedItems[].object.contentMap.en
@tenderlove @headius I only really needed it for SASL (SCRAM-* and ANONYMOUS), so I stopped after implementing the `saslprep` and `trace` profiles. By my count, there are at least three (incomplete) SASL implementations in stdlib and another half dozen in various gems, which... kinda defeats the purpose of SASL. After I finish my net-imap SASL updates, I hope to port to net-smtp and net-pop.

It would be nice if the stringprep bits found wider applicability too.

# orderedItems[].object.content
@tenderlove @headius I'm guessing (and a quick code search seems to confirm) that it's used for i18n domain names. I don't have any real experience with IDNA, punycode, nameprep, etc, but I did recently need a pure ruby saslprep. That led to a partial implementation of stringprep... which now ships with the latest `net-imap` release.

# orderedItems[].object.contentMap.en
@tenderlove @headius I'm guessing (and a quick code search seems to confirm) that it's used for i18n domain names. I don't have any real experience with IDNA, punycode, nameprep, etc, but I did recently need a pure ruby saslprep. That led to a partial implementation of stringprep... which now ships with the latest `net-imap` release.

# orderedItems[].object.content
@postmodern
Between stdlib and popular gems, I see many different implementations of buffered io transforms: IO (twice for encoding) and StringIO of course. But also: OpenSSL::Buffering, Net::BufferedIO (in 'net/protocol'), socket/init.c literally has a comment "copied from io.c", IRB::Locale & IRB::InputMethod, Zlib, Excon::Socket, Dalli::Socket, Net::SSH::Buffer, pg's C ext codec, rubyzip's zip/ioextras/abstract_{input,output}_stream, async's Wrapper and async-io's IO::Generic, etc...

# orderedItems[].object.contentMap.en
@postmodern
Between stdlib and popular gems, I see many different implementations of buffered io transforms: IO (twice for encoding) and StringIO of course. But also: OpenSSL::Buffering, Net::BufferedIO (in 'net/protocol'), socket/init.c literally has a comment "copied from io.c", IRB::Locale & IRB::InputMethod, Zlib, Excon::Socket, Dalli::Socket, Net::SSH::Buffer, pg's C ext codec, rubyzip's zip/ioextras/abstract_{input,output}_stream, async's Wrapper and async-io's IO::Generic, etc...

# orderedItems[].object.content
@postmodern I've often wished stdlib IO had built-in versions of IO/reader/writer combinators, e.g the kinds of methods that are in go's io and bufio or dart's StreamTransformer, Converter, etc. I've written "toy" versions of PipeSpy, TeeReader (& TeeWriter), ReadWriter, etc, some of these more than once.

# orderedItems[].object.contentMap.en
@postmodern I've often wished stdlib IO had built-in versions of IO/reader/writer combinators, e.g the kinds of methods that are in go's io and bufio or dart's StreamTransformer, Converter, etc. I've written "toy" versions of PipeSpy, TeeReader (& TeeWriter), ReadWriter, etc, some of these more than once.

# orderedItems[].object.content
@getajobmike @solnic IMO this falls under the category of "easier to test": it can be easier to debug and get diagnostic data from a Method Object, then add or expose methods that are useful for playing with on the console or in tests, even if nowhere else in the code base interacts with any method besides "call".

You _can_ return diagnostics in a status or result object. That can be wasteful unless lazy loaded. At some level of complexity, a (possibly memoized) instance can be simpler.

# orderedItems[].object.contentMap.en
@getajobmike @solnic IMO this falls under the category of "easier to test": it can be easier to debug and get diagnostic data from a Method Object, then add or expose methods that are useful for playing with on the console or in tests, even if nowhere else in the code base interacts with any method besides "call".

You _can_ return diagnostics in a status or result object. That can be wasteful unless lazy loaded. At some level of complexity, a (possibly memoized) instance can be simpler.

# orderedItems[].object.content
@vees 👋 🙂

# orderedItems[].object.contentMap.en
@vees 👋 🙂