ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:111050] [Ruby master Feature#12848] Crazy idea: Allow regex definition for methods (Do not take it seriously please)
       [not found] <redmine.issue-12848.20161017175434.3414@ruby-lang.org>
@ 2022-11-29  9:59 ` byroot (Jean Boussier)
  0 siblings, 0 replies; only message in thread
From: byroot (Jean Boussier) @ 2022-11-29  9:59 UTC (permalink / raw)
  To: ruby-core

Issue #12848 has been updated by byroot (Jean Boussier).

Status changed from Open to Rejected

Given the feature request I think we can just close it.

----------------------------------------
Feature #12848: Crazy idea: Allow regex definition for methods (Do not take it seriously please)
https://bugs.ruby-lang.org/issues/12848#change-100312

* Author: shevegen (Robert A. Heiler)
* Status: Rejected
* Priority: Normal
----------------------------------------
Me again, sorry - only crazy ideas coming about as of late here.

### Crazy idea: Allow regex definition for methods

I should wait until first april. :)

But anyway.

Consider this:

```ruby
def foo_bar
  puts 'hi there!'
end; alias foobar foo_bar
```

Ok now we can call this either as:

```ruby
foo_bar()
foobar()
foo_bar
foobar
```

All things work!

Here I was wondering ... what if I can omit the alias part?

Tada! Enter regex-defined methods as idea!

```ruby
def foo_?bar
  puts 'hi there!'
end
```

Now the above works too, without any alias. Yay!

I assume that this may not be possible perhaps syntax-wise - and
perhaps if it WOULD be possible, it should not be done anyway.

# It actually makes things harder to read, so I am also against this idea, too.

But!

It had to be published. :)

I think I remember once a collection of evil code in a file called
evil.rb. If I remember correctly, it may have been championed by
flori ... something. I even forgot the name. But it was pretty
fun. I don't remember if we could have shapechanging object but
I like the idea in itself (if we had that? I think you could
someone change the parent class ... somehow. Actually, this may
not be totally useless, I still think it may be a nice idea to
have things like a generic Button.new interface that gets
translated properly into the different GUI toolsets and also
for www code ... unify all the things!)

Things like that with evil.rb are sorta fun - experiment with evil
ideas that you should not use. There could be a whole type system
added in it as well! Mandatory type system - things that make you
unhappy when you use them. Since it is MANDATORY haha! :D

And then, on top of that, a ruby-to-crystal compiler just for the fun
of it (well, you write in ruby... and then just let it compile into
some binary via crystal ... without having to write crystal on your
own ... then you'd have the best of both worlds. Crystal feels heavier
on my brain than ruby but if it gives me faster binaries OR if I
can distribute code as a drop-out-exe for friends to use, this
would be good! My friends tend to be noobs so making things as
simple as possible is good. Also, I am much more a  crystal noob
than a ruby noob though I am also a ruby noob too. So the crystal
idea, well, actually - would be nice if ruby itself would have
that too. Like scripting languages that can be compiled! And
run like on something like JVM just not needing java haha.)

It's Caturday sorta, don't mind me.

So actually, I think my second idea would be to have something
like evil.rb again, in stdlib/core or so. We have some `GOTO`
stuff too somewhere (I don't remember where ... it is probably
too evil to google for it... but I did ... the variable
`SUPPORT_JOKE`. We could also `SUPPORT_EVIL` yes! Or perhaps
`SUPPORT_FUN` or something like that.)

I don't remember if evil.rb was really used a lot by anyone
else, but perhaps it would be fun to toy with crazy evil
features - and you can not rely on them being made available
either, they may disappear or re-appear!

Anyway, don't take any of this too seriously please.



-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-11-29  9:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <redmine.issue-12848.20161017175434.3414@ruby-lang.org>
2022-11-29  9:59 ` [ruby-core:111050] [Ruby master Feature#12848] Crazy idea: Allow regex definition for methods (Do not take it seriously please) byroot (Jean Boussier)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).