Hacker Newsnew | past | comments | ask | show | jobs | submit | draegtun's commentslogin

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.



Except in homoiconic languages, like Rebol/Red/Lisp, there is no (need for a) new syntax.


Or in Rebol/Red it's Parse, a dialect (DSL) that comes with the language - https://www.rebol.com/docs/core23/rebolcore-15.html


You can do this in...

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

  ;; Rebol/Red
  x: do [
     …
     5
  ]


Everything is subjective of course :)

I remember comparing Tcl/Tk with Rebol/View - https://news.ycombinator.com/item?id=7069311


Hopefully these two links will help:

- Definitional Scoping / Rebol actually does not have scoping at all - https://stackoverflow.com/q/21964110/12195

- Bindology - https://en.wikibooks.org/wiki/Rebol_Programming/Advanced/Bin...


Uh ... BrianH and Ladislav ... two of the real Rebol magicians. I can't wait to read the second again, and the first for the first time!


>> I think Cale is an underrated vocalist

I totally agree and more so on ballards.

The hairs on my back of my neck always stand up when I hear I Keep A Close Watch (especially the M:FANS version [1], but the original Helen of Troy version is also great [2] and there's plenty of wonderful live versions).

[1] https://youtu.be/d7wBvyrao8I [2] https://youtu.be/LoggPfL3dLU


To add to this "A Date with Perl" by David Rolsky (video below is from 2017 but he has same talk going back 10+ years).

https://youtu.be/enr5_FoToiA


>> 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]


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: