HNHacker News
TopNewBestAskShowJobs

hahainternet

1,457 karma · joined May 20, 2011

submissionscomments
hahainternet··on Why Would Anyone Use Perl 6?
> There is plenty of space for a language that delivers real innovation, or even one that puts real polish on old ideas. But when a language does neither, we absolutely should be asking what it's for

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.

hahainternet··on Why Would Anyone Use Perl 6?
> And it has to be a language feature in Perl 6 as there you don't have open classes as in Ruby or an equivalent feature for overriding operators or adding functionality to standard lib types.

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?

hahainternet··on Why Would Anyone Use Perl 6?
> What's wrong with using "isinstance(lst, str)" when necessary?

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

hahainternet··on Why Would Anyone Use Perl 6?
I'm not entirely sure you've illustrated that it's a bad idea. I believe that I illustrated that a simple pattern is not easily doable in Python but is in Perl 6. You'll have to show that this is a bad pattern or the implementation is bad or something at least to prove your point.

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".comb
hahainternet··on Why Would Anyone Use Perl 6?
You might be a little confused, I'm pretty sure that wantarray and the concept of functions caring about context is entirely gone in Perl 6. Now you are expected to return objects which 'do the right thing'.

However, 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.

hahainternet··on Why Would Anyone Use Perl 6?
Could you explain why you think this is awful? Perl 6 has proper sets, bags and the appropriate operators for 'normal' set operations too.
hahainternet··on Why Would Anyone Use Perl 6?
> I've no idea what all(@ar1) < any(@ar2) would be, I guess it would check that max(ar1) < max(ar2)?

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);
    False
hahainternet··on Why Would Anyone Use Perl 6?
Sorry I should have made things more clear. I am talking about in things like function signatures.

Doing 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.

hahainternet··on Why Would Anyone Use Perl 6?
> Only if your language is really awful. A good language shouldn't even let you run "5 < x" when x is a list, but even a mediocre one would surely at least make that error out at runtime rather than giving a nonsense answer.

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.

hahainternet··on Why Would Anyone Use Perl 6?
> actually not quite. given the plethora of libraries/frameworks etc. for perl-5, why would perl-5 programmers move to perl-6 ?

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

hahainternet··on Why Would Anyone Use Perl 6?
It's not so much SIMD. Perl 6 has a number of different constructs in which multiple operations can be carried out like that. However, yes the intention is to enable a large number of these scenarios to be carried out on multiple CPUs.

I don't think Rakudo implements that yet, but there's quite a lot to improve first.

hahainternet··on Why Would Anyone Use Perl 6?
Please point out a critique of the language in this thread.
hahainternet··on Why Would Anyone Use Perl 6?
> Why not "if 5 < x < 100"? Sigils look awful.

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.

hahainternet··on Why Would Anyone Use Perl 6?
It's not standard sets, it's a bit more than that, Perl 6 has sets of course, but Junctions should be able to autothread and express a sort of superposition of values.

http://doc.perl6.org/type/Junction

I could copy and paste the definition but it wouldn't be too helpful without context.

hahainternet··on Why Would Anyone Use Perl 6?
I too have been admiring Jnthn's latest posts. The reactive programming displayed is really quite lovely. God it actually makes me want to develop an asynchronous client! The only other language that makes me feel that way is Go.
hahainternet··on Why Would Anyone Use Perl 6?
Perl is pretty concise, but the list of criticisms above are almost meaningless. Who releases the first version of a language with most of the time spent on the optimiser?

Perl 6 loses quite a bit of the Write Only type syntax, and should be very succinct and expressive, but people just type nonsense :(

hahainternet··on Why Would Anyone Use Perl 6?
> If I want to transform my 100.000 line program to a smaller one I won't grab Perl 6 to transform it to 50.000 but I will grab Clojure for example to transform it to an 5.000 one. Is that the only argument for using Perl 6?

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.

hahainternet··on Why Would Anyone Use Perl 6?
> but in Ruby this would equally easy been done with "if [2,4,5,"hello",42,3.14].include?(x)".

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.

hahainternet··on Input methods for Unicode characters in editors and the shell
On a lot of Linuxes you can use alt-gr for third level keys too, which is handy for «» for example (altgr + z, x) or “” (v, b)
hahainternet··on Input methods for Unicode characters in editors and the shell
My apologies, I didn't notice that it wasn't explicitly mentioned on the input page.
hahainternet··on Input methods for Unicode characters in editors and the shell
I'm sure you're right, the REPL uses Linenoise which is single byte character only for example.

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.

hahainternet··on Input methods for Unicode characters in editors and the shell
I've seen some complaints about this, but the existence of Texas versions of the operators makes this absolutely fine in my eyes.

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 :)

hahainternet··on Perl 6 Released
Perl6 is actually ROAST, but Rakudo is the first compiler that approaches implementing it. Parrot was unfortunately discontinued but Rakudo will not be the only compiler (hopefully!)
hahainternet··on Perl 6 Released
There are ASCII equivs for most, they're called 'Texas' operators.
hahainternet··on Android NDK: GCC is now deprecated, everyone should be switching to Clang
There's no offer there. Please don't dishonestly quote.
hahainternet··on Why Python 3 Exists
> Please, tell me what you actually think is correct behavior. It is far, far more useful than pointing out that something is "wrong" on purely semantic arguments.

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.

hahainternet··on Why Python 3 Exists

    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 ि
hahainternet··on I included emoji in my password and now I can't log in to my Account on Yosemite
If you ever order from HobbyKing (not the store I mentioned previously) do NOT have a plus in your email. It gets converted silently to a space in their internal systems and their customer support has absolutely 0 access or escalation.

They outsource everything, and ultimately it took me months to sort everything out.

hahainternet··on I included emoji in my password and now I can't log in to my Account on Yosemite
I know of an online store that if you use a + in your email address, will fail to charge you for any goods you order.

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.

hahainternet··on Google Begins Rolling Out Google Play Music Family Plan
> With ad revenues drying up

Haven't their revenues been going up despite the CPC going down?

← PreviousPage 3 of 29Next →