On Sat, Jan 21, 2017 at 02:01:59PM +0100, Denis Kudriashov wrote:
> Hi.
> 
> 2017-01-20 16:15 GMT+01:00 Peter Uhnak <i.uh...@gmail.com>:
> 
> > In Ruby it is dead simple:
> > str[/\[(.*)\]/,1].hex # "=> 37"
> >
> 
> I always wondering when people think it is dead simple.
> I use streams for such cases. It is logical, readable and dead simple

I've never mentioned readability, because the code is throwaway.
I guess if you are not using regexes it could look odd, but as a linux user it 
is very casual; if I had to extract the information I would just pipe it 
through sed or grep.

I wouldn't use such thing in code that I want to keep, but I explicitly 
mentioned that.


> approach without crappy syntax. And with Xtreams library it become much
> more easy and fun

Are there any docs for Xtreams? I found several repositories, but none explain 
what Xtreams even is.

---

>
>> In Ruby it is dead simple:
>>
>
> and dead unreadable
>
> Pharo way is both dead simple and dead readable

Dtto as above. Readability was never a question. And if it was, then you just 
doubled the regex complexity, and made the code more confusing by turning the 
problem upside down, due to the limited API.

Complaining about the compact syntax makes as much sense as complaining that 
`1+2` is too cryptic and should be written as `1 digitAdd: 2` (which you can do 
btw); the point of compactness is that when you know what you are doing you can 
save some time.

You can always write .match() instead of []; e.g. in python:

int(re.split('\[(.*)\]', str)[1], 16)
int(re.search('\[(.*)\]', str).group(1), 16)

But my point was not addressing this particular problem, but the general 
problem --- I often find it much easier to preprocess data with standard linux 
tools and then feed it to Pharo then to try to do the same in Pharo itself.

Peter

Reply via email to