draegtun

Joined 18 years ago

Karma
4,727
Submissions
1,540
Member since
Aug 5
/I3az/

blog - http://transfixedbutnotdead.com

work - http://www.draegtun.com

twitter - http://twitter.com/draegtun

LinkedIn - http://www.linkedin.com/in/draegtun

github - https://github.com/draegtun

cpan - https://metacpan.org/author/DRAEGTUN

View on Hacker News

Recent submissions

Comment · 4 months ago
The article doesn't mention Perl at all but it did have some direct influences on Ruby.

Even Ruby's trailing blocks syntax are an homage to Perl's block list subroutines:

  # first Ruby example in article
  users.select { |u| u.admin? }.map(&:email)

  # using Perl's block list
  map {$_->email} grep {$_->is_admin} @users;
Comment · 10 months ago
Yes (de)referencing can be a PITA sometimes but you've probably forgotten that your example code could have been better written like this:

    $hash1->{key1}{key2}
And if `hash1` was a hash (instead of a hashref) then it's just this:

    $hash1{key1}{key2}
The `%{}` de-reference you mention later is only when you have an operation that requires a hash, for eg:

    keys %{$hash1{key1}}
And for kstrauser example later in Python...

    hash1["hash_name"]["array_name"][3]
the equivalent in Perl would be...

    $hash1{hash_name}{array_name}[3]
I find having {} & [] as lookup keys for their types is not only more explicit but also safer/correct.
Comment · 1 year ago
Comment · 1 year ago
Except in homoiconic languages, like Rebol/Red/Lisp, there is no (need for a) new syntax.
Comment · 1 year ago
Comment · 2 years ago
You can do this in...

  # perl
  my $x = do {
     …
     5
  };

  ;; Rebol/Red
  x: do [
     …
     5
  ]
Comment · 2 years ago
Comment · 2 years ago
Comment · 2 years ago
Comment · 2 years ago
Comment · 3 years ago
>> It really should be a few lines of code to add an “unless(X) {}” statement to “if(!X) ()” to...

Or even one line :)

Factor...

  : unless ( ? quot -- res ) swap [ drop ] [ call ] if ; inline
Rebol/Red...

  unless: func [expr block] [either expr [] block]
Comment · 3 years ago
Here's a video where Crockford mentions Rebol (and others) being an influence on JSON - https://www.youtube.com/watch?v=-C-JoyNuQJs&t=1233s

I've seen it mentioned on Rebol chatter that Crockford approached Carl Sassenrath (creator of Rebol) to open-source & use Rebol prior to creating JSON. So having a Javascript literal wasn't on Crockford's mind at that point.

NB. Rebol was closed sourced until 2012.

Comment · 3 years ago
Comment · 3 years ago
Comment · 3 years ago
>> People pretends Smalltalk doesn't exist?

And Factor and many implementations of Lisp too!

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton