Oh please. Perl 6 does both of these very nicely. Dismissing it out of hand as you have just done is exactly what the parent is complaining about.
1,457 karma · joined May 20, 2011
Oh please. Perl 6 does both of these very nicely. Dismissing it out of hand as you have just done is exactly what the parent is complaining about.
I'm not sure what makes you think this. I'm not very familiar with Ruby's internals but Perl 6's MOP certainly supports modifying classes, you can add your own operators etc.
Could you provide a more explicit example?
In order for it to be like the Perl6 implementation I would have to check against every type of iterable AFAIK. For example, a generator would be perfectly acceptable, but is there a unique function I could check with hasattr?
Clearly you feel that sigils are intrusive in Perl 6, but having written a bunch I find it quite enjoyable, and they're pretty easy to find in the documentation too. Ultimately, you can use variables without sigils, but with caveats: http://doc.perl6.org/language/variables#Sigilless_variables
There's more to sigils than just scalars and arrays too, as you can see here: http://doc.perl6.org/language/variables#Sigils
The difference in your examples are that scalars describe more the 'shape' of the variable than its type. Given that a lot of programming is dealing with lists or 'dictionaries' this is a fairly minimal intrusion into the code that very much improves succinctness, correctness and the ability to easily read what some code is doing.
Oh, and strings don't act like arrays in Perl 6 AFAIK. Because they could be split on characters, or codepoints, or bytes, you must be explicit:
> for "Hello".comb -> $c { say "Character $c" }
Character H
Character e
Character l
Character l
Character o
(Or to be perly) > .say for "Hello".combHowever, if you really want to do some of the other things you've listed they are possible to do. Perl 6's syntax can be augmented by the programs being executed.
I'm honestly interested though, was I ultimately wrong above? Is there a smart way to define a function in python that can take both a single item and a list of items? In Perl 6 I'd just define a multi sub where the list form applies the single item sub for each item in the list.
It seems that it just expands the lists using the operator. The output from junctions is quite nice:
> my @a = <1 2 3 4>;
> my @b = <2 3>;
> say all(@a) < any(@b);
all(any(True, True), any(False, True), any(False, False), any(False, False))
> say so all(@a) < any(@b);
FalseDoing something like isinstance(x, str) is discouraged and considered non-pythonic, and recently hasattr() has also been talked about. However, both strings and lists can be iterated, so assuming that this will fail is incorrect:
x = "Hello"
for y in x:
print("{} is {}".format(y, type(y)))
I asked on IRC and ultimately the only answer I got was that the most pythonic way to do things was to name functions whatever_str and whatever_list.edit: I also should have said above "lists can't be compared with strings using <". I was trying to point out Python did things potentially correctly there, but I see now it's ambiguous.
It depends what you consider "Nonsense". Python for example has no reliable way to differentiate between a string and a list. Strings are iterable, but lists can't be compared with the < syntax for example.
My point is simply that $x very clearly says (in Perl 6) "A single value called x" wheras @x is "A list of values called x". In python, "x" is indeterminate even at runtime.
Oh, and you can declare barewords with \x for example, if you really want to, it is Perl after all.
I'm a Perl 5 programmer. Perl 6 is a more perly Perl. I can use my Perl 5 modules if I really want, but I can write better specified, safer and more logical code. Just having simple functions like 'whenever' makes developing fun and easy.
Please see http://jnthn.net/papers/2015-yapcasia-concurrency.pdf for context
I don't think Rakudo implements that yet, but there's quite a lot to improve first.
Because sigils tell you things. What if 'x' in your example is a list? Are you now checking the length of the list rather than the value? Sounds like room for a security bug to me.
http://doc.perl6.org/type/Junction
I could copy and paste the definition but it wouldn't be too helpful without context.
Perl 6 loses quite a bit of the Write Only type syntax, and should be very succinct and expressive, but people just type nonsense :(
What a weirdly arrogant and ignorant statement. If you're writing 20x as much code instead of using Clojure, then you're doing some pretty terrible programming.
I fail to believe that those 6 points could have been written by someone unbiased. Please show me some Clojure that's 10x more succinct than Perl 6. Otherwise then surely this counts as trolling.
But that isn't the same is it. That's only a related feature because Ruby doesn't have first class Junctions.
> I wonder if it will gain enough traction from non perl programmers.
These days people have been taught to be arrogant. To assume their language is the best. This is what makes things a tough challenge.
The only way to fix these problems though is to increase their use, so ultimately the end goal will be worth it. That seems to have been the Perl 6 mantra for a decade or so.
I don't see why people would begrudge the ability to use the 'proper' mathematical symbols just because they're slightly harder to type.
Of course, it's another situation where Perl 6 is just crazy, but crazy awesome :)
You say "wrong" as if that's a quote from me. But it's not. Yes, strings have to be arrays, but how they work depends on the semantics of your language.
I'm not entirely happy with Python 3 because I don't think they really took their time to improve on the warts. I doubt there's a one-size-fits-all solution.
In [1]: len("नि")
Out[1]: 2
So close, but it's not really a string or bytes, but a codepoint array. You can even iterate it: In [2]: for c in "नि":
...: print("Character {}".format(c))
...:
Character न
Character िThey outsource everything, and ultimately it took me months to sort everything out.
I'm assuming because something somewhere on their backend assumes that '+' is an invalid email character and refuses to process the job. This is unbelievably common.
Haven't their revenues been going up despite the CPC going down?