mauke
Recent Actions
- Posted Automated testing on Windows with AppVeyor to mauke
-
Posted /Fizz|Buzz/ to mauke
use v5.12.0; s/\A(?:[0369]|[147][0369]*(?:[147][0369]*[258][0369]*)*(?:[147][0369]*[147]|[258])|[258][0369]*(?:[258][0369]*[147][0369]*)*(?:[258][0369]*[258]|[147]))*(?:0|[147][0369]*(?:[147][0369]*[258][0369]*)*5|[258][0369]*(?:[258][0369]*[147][0369]*)*…
-
Posted Converting glob patterns to efficient regexes in Perl and JavaScript to mauke
In Glob Matching Can Be Simple And Fast Too Russ Cox benchmarked several glob implementations by matching the string
a
100 against the pattern (a*
)n -
Commented on Cool Perl 6 features available in Perl 5
The problems with @{[ ]} are that it looks quite clunky, it's inefficient at runtime (it builds and dereferences an arrayref), it evaluates its contents in list context, and it gets really confusing if you need (nested) quotes in the...
-
Posted Cool Perl 6 features available in Perl 5 to mauke
Today I saw Damian Conway giving a talk at YAPC::NA 2016 (also known as The Perl Conference now :-). He was talking about some cool Perl 6 features, and I realized that some of them are…
-
Commented on Newbie Poison
This whole post looks unpleasant. > Many won't even concede that the behavior I called out was unpleasant in the first place. This sounds like "Many people disagree with me, how dare they" to me. (I'm one of them.) -...
-
Commented on I think subroutine signatures don't need arguments count checking
I think argument checks are a good thing because correctness is more important than speed (who cares how fast you are at getting the wrong result?). Checking the arguments manually is annoying boilerplate code that no user wants to bother...
-
Posted Perl curio: For loops and statement modifiers to mauke
Perl has a "statement modifier" form of most control structures:
EXPR if EXPR; EXPR unless EXPR; EXPR while EXPR; EXPR until EXPR; EXPR for EXPR;
Perl also has a ="ht…
-
Posted Perl curio: Dereferencing blocks to mauke
We're all familiar with references and Use Rule 1:
You can always use an array reference, in curly braces, in place of the name of an array.
This leads to code like
="prettypr…
-
Commented on Converting glob patterns to regular expressions
Text::Glob doesn't treat repeated * specially, no. But it supports many other features (wildcards don't match a leading dot, curlies, etc) plus it uses a rather C-like approach to converting the pattern (iterating over single characters, state machine) so it...
-
Commented on Converting glob patterns to regular expressions
Eh, it's generated code. I don't care much about how readable it is. :-) I don't think your version handles the last case with backslash escapes....
-
Commented on Converting glob patterns to regular expressions
I'm not doing full-blown shell filename expansion, so I simply don't support [...] here....
-
Commented on Converting glob patterns to regular expressions
The original inspiration for this came from matching general text, not file names. That's why / isn't treated specially. (In one place I use this for matching some HTTP header values, in which case . is actually [!#$%&'*+\-.^`|~\w].)...
-
Posted Converting glob patterns to regular expressions to mauke
Let's say you have a glob pattern with shell-style wildcards from a config file or user input, where
?
matches any character and*
matches any string (0 or more characters). You want to convert it to a regex, maybe because you just… -
Posted Fun with logical expressions 2: Electric boogaloo to mauke
tybalt89 discovered a bug in Fun with logical expressions:
$ echo IEabEba | perl try.pl ORIG: IEabEba MOD: V~V~V~a~b;~V~~a~~b;;V~V~b~a;~V~~b~~a;;; ...> V~V~V~a~b;~Vab;;V~V~b~a;~Vba;;; ...> V~V~V~a~b;~Vab;;~V~…
-
Posted Functional fun with logical expressions to mauke
Here's a quickly thrown-together version of "Fun with logical expressions", written in Haskell:
{-# LANGUAGE LambdaCase #-} module Main (main) where import Control.Applicative (Applicative (..), (<$>)) impor…
-
Posted Fun with logical expressions to mauke
Addendum 2: This set of rules is incomplete. See Fun with logical expressions 2 for an improved version.
Addendum: I've written a more or less equivalent …
-
Posted Spam from waag.org to mauke
Today I got this spam message:
From: Tessel van Leeuwen <tessel@waag.org>
Subject: Invitation: Join the Apps for Europe competition and win 5,000 euro!
To: undisclosed-recipients:;Hello,
…
-
Posted PHP puzzle to mauke
So I've decided to make a little PHP puzzle.
The following program contains 3 test cases that you need to make pass. To do that, you should replace
XXX
in the assignments to$a
,$b
and -
Commented on Cool things you can do with Perl 5.14
So far I've always used package Foo { method meth($arg) { ... } }....
-
Posted Cool things you can do with Perl 5.14 to mauke
Perl 5.12.0 introduced This feature lets a module author extend Perl by defining custom keywords, at least as long as that module author knows XS and ho…
-
Commented on C Programming: What is the difference between an array and a pointer?
Well, that's because (with the exception of VLAs in C99) sizeof is purely a compile time operation. It only looks at the types: sizeof EXPR == sizeof (typeof(EXPR)) (if we pretend C had typeof for a moment)....
-
Commented on C Programming: What is the difference between an array and a pointer?
Note that there's an interesting parallel between C and Perl when it comes to arrays. Neither C nor Perl have array values (that is, values that represent arrays). When you evaluate an array in C, you get a pointer to...
-
Posted C Programming: What is the difference between an array and a pointer? to mauke
Why is a raven like a writing-desk?
(Lewis Carroll)This is a copy of an article I wrote a long time ago. I'm putting it here to give it a more permanent home. Sorry for being off topic again!
Introduction
I'm glad you asked. The answer is sur…
-
Posted Exit statuses and how $? works to mauke
The other day I was wondering about
$?
in Perl and the shell and how exit statuses work.First off, there are two ways a unix proc…
-
Commented on Why you probably don't want to use claws-mail
I don't quite agree. OK, there's the "doesn't "enable" shit" comment early on, but that was directly followed by a list of concrete questions I had after seeing the documentation. But the funny part is that the answer given by...
-
Posted Why you probably don't want to use claws-mail to mauke
I've been using claws-mail as my email client for a while. When I couldn't figure out how to do that even after consulting the claws manual, I went to t…
-
Posted Two RegExp bugs in Internet Explorer 8 to mauke
It turns out there are at least two bugs in IE 8's Javascript regex engine. One of them is widely known, the other one doesn't seem to be.
Testcase:
/^(?:(?=(.))a|(?=(.))b|(?=(.))c)/.exec('bar')
Correct result:['b', undefin…
-
Posted Javascript: adding a unique ID to every object to mauke
This entry is about Javascript, not Perl. It's about object identity in particular.
If you have two objects in
x
andy
, you can check whether they're really the same object withx === y
. Howe… - Posted Stripping color codes in irssi scripts to mauke
Comment Threads
-
Yuki Kimoto commented on
I think subroutine signatures don't need arguments count checking
and PHP
function foo($x, $y) {
}
foo(1) // ok
foo(1, 2) // ok
foo(1, 2, 3) // okI like JavaScript and PHP way. This is natural.
-
weissel commented on
I think subroutine signatures don't need arguments count checking
Hmmm.
Yuki, you seem to have a strong opinion here.
Not that there is anything wrong with having strong opinions --- but it would be much better if you could at least point to some facts that support your opinion.
Like, say, benchmarks. Like, say, code (show the source code!) that does run appreciably faster without argument checking.Performance at all costs of programmer usability, maintenance and bug finding ease would mean that you write highly optimized, hand-polished assembler running on the bare metal of the machine, with no OS to slow things down…
-
Duncan White commented on
Newbie Poison
Like others, I think you were a bit harsh picking out the "what CPU" question, that response seems clear simple and polite to me.
But I do agree that the "bad practices" second answer was rather snotty and unhelpful - especially saying that the OP's code had several bad practices but not bothering to clearly explain: which specific bad practices he had in mind. Maybe the commentator had had a bad day?
More generally, I completely agree that we should take the time to reply helpfully and politely on various Perl beginner forums.
-
bois commented on
Why you probably don't want to use claws-mail
I never heard of claws mail until today, I did a quick search to gather some info and this page was in the first results.
The IRC logs imply a blatant mistake, if not a perverse evil intent, on the maintainers' part for not documenting what is without doubt an essential function of a mail software that aims to be user-friendly. But, as anyone who has ever done useful work to the society knows, when a maintainer and a user have a heated argument, typically it's the user who has a problem. So, inspired by your post, I decided to try claws mail out to decide whether it is worth my time …
-
bois commented on
Why you probably don't want to use claws-mail
And yes, I'm not going to help someone who is unable to follow guidance from upstream or at least cooperate with them, because I dream of a better world where people don't troll at volunteers.
About blogs.perl.org
blogs.perl.org is a common blogging platform for the Perl community. Written in Perl with a graphic design donated by Six Apart, Ltd.