Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • May 21 16:25
    hiiamboris labeled #5144
  • May 21 16:24
    hiiamboris opened #5144
  • May 21 15:55
    hiiamboris commented #5139
  • May 21 09:27
    GiuseppeChillemi commented #120
  • May 21 07:26
    endo64 commented #120
  • May 20 17:43
    greggirwin commented #5026
  • May 20 17:43
    greggirwin commented #5026
  • May 20 15:18
    rebolek commented #5026
  • May 20 00:33
    ALANVF commented #4552
  • May 19 07:45
    hiiamboris commented #113
  • May 19 07:40
    Oldes commented #113
  • May 18 22:06
    ALANVF opened #5143
  • May 18 20:19
    greggirwin commented #5026
  • May 18 20:18
    greggirwin commented #5026
  • May 18 19:31
    hiiamboris commented #5142
  • May 18 19:29
    hiiamboris synchronize #5142
  • May 18 19:27
    hiiamboris commented #5142
  • May 18 19:26
    hiiamboris commented #5142
  • May 18 19:16
    greggirwin commented #5142
  • May 18 12:26
    hiiamboris edited #5142
GiuseppeChillemi
@GiuseppeChillemi
I don't know the reason but I don't like this. It complicates the portability of blocks, forcing us to have a sidecar.
hiiamboris
@hiiamboris
Reason is refinements and issues are symbolic only tokens by design and should not carry any hidden payload.
hiiamboris
@hiiamboris

By far my most common case for filenames is date-naming them, which isn't a good match for composite and handled better by format.

It's good until you want to customize it a lot.

GiuseppeChillemi
@GiuseppeChillemi
The problem is that we do not have a direct make block nor a visual representation of the context with refinements information. Also, actually there is no easy way of getting the refinements from the inside without parsing the specs block.
Once you get all in [[keys][values]] split form with refinement you have to make a last management of the keys block to extrapolate the refinements, change to words and build a separate refinements block in case you would need this information.
GiuseppeChillemi
@GiuseppeChillemi
While for objects contexts it is easy to manage, copy and transfer it, for function ones it is very complicated.
Greg T
@gltewalt
Sorry about my github blunders
Gregg Irwin
@greggirwin
@lnxw37d4:matrix.org thanks for the reminder. :+1:

It's good until you want to customize it a lot.

I guess I've always customized them a lot, because it's so helpful IMO. e.g. zero padding counts and ISO8601 formatting dates, so lexical sorting works.

gltewalt (The other Greg)
@gltewalt:matrix.org
[m]
Backtick itself isn't hard to type. It's one keystroke on my keyboard
Gregg Irwin
@greggirwin
By itself, I agree. But #' has a shift and unshift, and '" ... "' has shift-unshift on each end, plus wide space between the backtick and quote, at least on U.S. keyboards. Using ticks, as Gitter is driving me mad trying to get backtick syntax right.
Greg T
@gltewalt
Wide space between backtick and quote, but backtick is close to the left hand
About as close as ( ) is for the right hand
hiiamboris
@hiiamboris
@greggirwin if `"..."` is so utterly bad for you, let's consider just an empty issue # "...", because #` is completely ugly and using only opening quote makes no sense to me, if it's quotes they should be on both ends. # "..." is somewhat similar to char syntax though. But then any other symbol allowed in issues will be better than backquote. ## #! #$ #% #= #| #/ #\ #. #~
hiiamboris
@hiiamboris
I would still prefer them backticks on both ends. Simplest syntax and readable unless your font is not monospace and you're not using syntax highlights.
hiiamboris
@hiiamboris
(editor) (gittard) (GUI console) this is how it looks for me without any steps done on my end (and I would highlight backticks and all operators)
hiiamboris
@hiiamboris

A poll from Nenad ☻

Which way to you guys use try most of the time?

  1. To silence errors, as in if error? try [...] [..after-error recovery..]
  2. To catch errors and process them later, as in set/any 'err try [...] (... later err is processed...)
  3. I never used try

Please post your answers into thread if possible. Thanks.

18 replies
Oldes Huhuman
@Oldes
@hiiamboris may I ask what we should expect as a result of this poll? And why Nenad is not asking here himself anymore?
Gregg Irwin
@greggirwin

The new try/keep feature is there now, for including stack traces, but we don't know if it should be the default.

Being on Gitter can take a lot of time and pull focus. When there's a Nenad sighting, people tend to swarm. I'm sure he'll reappear here at some point.

gltewalt (The other Greg)
@gltewalt:matrix.org
[m]
Instead of try / catch, how about... what amounts to enums... custom types that only accept a few things - either succeeds or the error message comes directly from the type
Gregg Irwin
@greggirwin
Do you mean like specific exception values, as in Java?
Note that in Red try/catch isn't a thing. We have throw/catch which is not specifically error related, but is about general non-local flow control.
gltewalt (The other Greg)
@gltewalt:matrix.org
[m]
See the chit chat room
Yes, but when I think of try, catch is always trying to sneak into to the party
Into
Gregg Irwin
@greggirwin
Ah, category types as in Haskell, got it.
Gregg Irwin
@greggirwin
For those more versed in Java and Haskell, the two approaches are very similar, aren't they? You have to declare all the specific exception/error types that can occur, and then you need to specifically handle each one of them.
gltewalt (The other Greg)
@gltewalt:matrix.org
[m]
I dont know much about Java. I could never bring myself to use it.
gltewalt (The other Greg)
@gltewalt:matrix.org
[m]
You handle each one in a custom type that ideally models your application - for error messages, There's a separate type for recovery.
Gregg Irwin
@greggirwin
It's an age-old question, without a single answer that is right for every situation. Treating errors symbolically moves toward general symbolic computing, which Red is well suited for.
karthik
@kskarthik:poddery.com
[m]
Does red standard lib has http server ? That would be useful
Boleslav Březovský
@rebolek
@kskarthik:poddery.com that certainly would be :-) Current Red’s IO is pretty limited, you can do requests and not serve anything, however, there’s IO branch with the new IO which can do both and you can write a HTTP server with it. I am working on one and I believe there will be some simpler variant in the standard library (basic HTTP/1.0 server can be done in few lines).
Boleslav Březovský
@rebolek
Here’s the server in action
it’s not much, I know :-)
karthik
@kskarthik:poddery.com
[m]
@rebolek: nice!!
Boleslav Březovský
@rebolek
@kskarthik:poddery.com Thanks! My current focus is not content, but strong server security by default where it does not stand very bad
hiiamboris
@hiiamboris
Looks like we've got trojans uploaded to our wiki. I reverted it and reported it using GH form, for now.
karthik
@kskarthik:poddery.com
[m]
@hiiamboris: github wiki's are editable by anyone. Better to move wiki to version control
hiiamboris
@hiiamboris
If that repeats we should consider it. OTOH, being editable is convenient for us all.
Gregg Irwin
@greggirwin
Thanks for taking care of that @hiiamboris.
GiuseppeChillemi
@GiuseppeChillemi

Do we have a function that creates a contex and binds the following code to context it running?

I want to create a with function:

with [a: 33 c: 33] [...code...]

Which is equivalent to:

do bind [...code...] make object! [a: 33 c: 33]

But I would like to know if it already exists.

Feedback is welcome, as there are many variants out there and it's likely something we will make standard.
GiuseppeChillemi
@GiuseppeChillemi
This would make elements setting in objects really fluent.
Oh my God, I have deleted everything instead of editing it! :-(
GiuseppeChillemi
@GiuseppeChillemi

Here I am again:

Why not allowing path in parse SET? It would make setting values in context very easy: (Please pardon me the wrong usage of IFbut I have still not studied it)

valid?: func [data test-name] [
   result: switch test-name [
           size [either data ... [true] [false]]
           position [either data ... [true] [false]]
   ]
]

options: [size 00x200 position above]
ctx: make object! [
   size: none
   position: none
]
parse options [
    set ctx/size 'size pair! (if not valid? ctx/size 'size] [fail!]
    set ctx/position 'position word! (if not valid? ctx/position 'position] [fail!]
]
Note: options: [size 300x200 position above]
But Gitter removes the number 3 for no reason!
Gregg Irwin
@greggirwin
@dockimbel noted red/red#3528 that path's higher overhead is a primary reason they aren't supported. However, if you don't use paths and aren't penalized, I don't see why those who want to use them shouldn't be allowed to. As long as they don't complain about performance. If there's no wish ticket for that, feel free to open one.
Toomas Vooglaid
@toomasv
@GiuseppeChillemi You can bind the rule to ctx. E.g. working example:
between?: func [data min-test max-test][
    all [min-test <= data max-test >= data]
]
valid?: func [data test-name] [
    switch test-name [
        size [all [between? data/x 250 500 between? data/y 200 400]] 
        position [find [above below left right] data]
    ]
]
ctx: make object! [size: none position: none]
options: [size 300x200 position above]
parse options bind [
    'size set size pair! if (valid? size 'size) 
    'position set position word! if (valid? position 'position)
] ctx
== true

ctx
== make object! [
    size: 300x200
    position: 'above
]
GiuseppeChillemi
@GiuseppeChillemi
@toomasv thanks, I know this tecnique but it has 2 drawbacks: you can't use it on blocks; the more the size of the context words, the more the probability it uses words between parens (in case of longer and parse rules and code in parens).