Skip to content
This repository has been archived by the owner on Jul 17, 2020. It is now read-only.

$encode can't handle commas #252

Open
caub opened this issue Oct 23, 2015 · 1 comment
Open

$encode can't handle commas #252

caub opened this issue Oct 23, 2015 · 1 comment

Comments

@caub
Copy link

caub commented Oct 23, 2015

!!learn encode $encode($0)
!!encode test shit fuck
@crl test%20shit%20fuck
!!encode test, shit , fuck
@crl test

I don't understand where the rest of the string is gone? dropped by SO chat? if yes would there be a way to handle this?

@Zirak
Copy link
Owner

Zirak commented Nov 4, 2015

This happens because I'm an idiot and didn't learn from my predecessors.

The /learn command implements some sort of macro language, which basically acts like a text preprocessor: It searches text for variable denotations and replaces them with their textual value.

So the following happens:

macro = "$encode($foo)
foo = "blah baz"

// first pass of the replacement catches `$encode`, parses its arguments:
macro = $foo
foo = "blah baz"
output = "blah, baz"

// which means it's translated to:
$encode(blah, baz)

Which only encodes the first argument.

This is fucking bash all over again. Because under bash, the solution is: $encode("$foo"), but of course I didn't implement string interpolation, so there is no solution.

Fuck me.

As said in #254, I detest how /learn grew to become something which needs to have computational power, but lacks any sort of semblance to logic (you don't even have fucking if statements). /learnEval would be much, much better.

So lazy though. So lazy.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants