« first day (1653 days earlier)      last day (2127 days later) » 
00:00 - 19:0019:00 - 22:00

7:04 PM
@rgchris Less get-word! args, and return-spec can appear once anywhere, and local-spec more than once anywhere.
 
@MarkI I thought get-word! args were already deprecated?
 
@rgchris No, they are quite useful, and different from lit-word! args.
 
What are they used for now?
 
@rgchris Basically to prevent parens from being evaluated.
 
@rgchris get-args are the general method for passing unevaluated arguments.
Not deprecated. In fact, if anything, lit-args would be up for deprecation in R3 (as they can be fully subsumed with get-args).
 
7:09 PM
@earl Curious, how? Adding if paren! = type? arg [arg: do arg] everywhere?
 
@MarkI Basically, yes.
"lit-args" in R3 evaluate paren!, get-word!, and get-path! arguments.
"get-args" in R3 don't evaluate, no exceptions.
 
>> do func ['arg][probe arg] arg
 
; Brought to you by: try.rebol.nl
arg
== arg
 
What would be the get-word! equivalent?
 
See groups.google.com/d/msg/red-lang/fBFcgty3Ox4/aLn4WEwSY3UJ for an extensive treatise, if interested.
>> do func [:arg] [probe arg] arg
 
7:11 PM
@rgchris I think he's getting at you have to evaluate it yourself if it's "active".
 
; Brought to you by: try.rebol.nl
arg
== arg
 
@MarkI Yes, but it's not "active" in the sense of "active" values for regular (do/next) evaluation.
 
@earl Oh right, was trying it at the Rebol 2 console, d'oh!
 
>> do func ['arg] [probe :arg] :add
 
; Brought to you by: try.rebol.nl
make action! [[
    "Returns the addition of two values."
    value1 [scalar! date!]
    value2
]]
== make action! [[
    "Returns the addition of two values."
    value1 [scalar! date!]
    value2
]]
 
7:13 PM
>> do func [:arg] [probe :arg] :add
 
; Brought to you by: try.rebol.nl
:add
== :add
 
@HostileFork Interesting idea.
I think I like the look of the more explicit return: ... local: ... better.
 
@earl I lean toward that too.
 
@rgchris I think for now, return: is just supposed to allow you to specify a typespec and documentation for returned values.
No word in return:, no "assign to this word to specify the return value".
And yes, I think you'd have to specify error! in the return typespec if you return an error! value.
 
return: is OK, IIRC there was some change in routines in the past. But not sure about local: a b c - that should be imo a block ...
 
7:24 PM
Not sure I like the idea of mix and match local: and args, seems a recipe for confusion...
 
@pekr What about: if a block of words is first, it's the return typespec, else if a block of words shows up where an arg would fit, it's local words. No keywords ... just confusion? :)
 
function [local: a b c params: d local: e return: [f] params: /g h]
 
@rgchris Keywordy AND wordy :)
 
@rgchris Looks good (docstrings missing, but besides the point atm, I think :).
 
Yeah, doc strings omitted...
 
7:28 PM
you really can't have local: a b c imo, that's an multi assignment ...
well, maybe you can, just dunno ...
 
@pekr It's a dialect, we can do almost anything, design-wise :)
 
yes, further confuse users :-)
 
@pekr Note how presently you don't need a block for /local a b c.
 
Also, I wasn't endorsing that particular example, quite the opposite.
 
but /local is clearly a special form, assignment is not, used thruout the language ...
if docs are good, why not ...
 
7:30 PM
@pekr It's not special, just convention.
 
@pekr A set-word! is only primarily assignment in the DO dialect.
func [a [integer!] b [integer!] return: [integer!] local: x y]
vs
 
I think set-word! would look just right: function [d /g h return: [f] local: a b c e][...]
 
func [a [integer!] b [integer!] return: [integer!] local: [x y]]
 
(sorry @earl :)
 
we should think also about objects, object spec blocks (if they ever come), routines, etc.
 
7:34 PM
vs
func [[integer!] a [integer!] b [integer!] [x y]]
My idea. Please shoot it. :)
 
@MarkI What if [x y] were typesets? func [b [x y]]
 
what about 'function then? It's second argument is block of local words? Well, maybe it does not collide, idea wise?
 
@pekr I believe that version of function is dead.
 
@rgchris Right, you would have to supply a typespec between a parameter and a local-spec. Empty [], possibly.
 
It only ever appended a /local a b c extension to the spec block.
 
7:37 PM
@pekr That does no longer exist. Has been replaced by what was previously FUNCT.
>> help function
 
; Brought to you by: try.rebol.nl
USAGE:
    FUNCTION spec body /with object /extern words

DESCRIPTION:
    Defines a function with all set-words as locals.
    FUNCTION is a function value.

ARGUMENTS:
    spec -- Help string (opt) followed by arg words (and opt type and string) (block!)
    body -- The body block of the function (block!)

REFINEMENTS:
    /with -- Define or use a persistent object (self)
        object -- The object or spec (object! block! map!)
    /extern
        words -- These words are not local (block!)
 
@MarkI I thought you were joking :) But if you insist: consider it shot down. Gibberish!
 
rebol2> probe function [a][b][]
 
what? 2.101 still has it, maybe I should upgrade :-)
 
; Brought to you by: try.rebol.nl
func [a /local b][]
== func [a /local b][]
 
7:38 PM
@pekr You should :) That particular change has even been merged into mainline rebol/rebol for a while.
 
@earl Why? Gibberish = anything without keywords?
 
@MarkI Are you really not joking / playing devil's advocate?
 
@earl I am serious about my no-keywords-in-function-specs idea, yes.
 
I have many R3s here, it is just apparently my Console2 New tab for R3, which links to some old one. Good to find out :-)
 
Why would you want to disallow perfectly good words like return and local as parameter names?
 
7:40 PM
@MarkI Why would they be disallowed?
 
@earl Er, because you are assigning them a different meaning?
 
@MarkI Nope. Only set-word!s, which don't have a meaning at all, at the moment.
 
Not necessarily. It is refinements, which are effectively disallowed .... imo ...
 
@earl Oops, yes, you mean set-words though, and I see it now.
 
@MarkI Sorry, yes, set-word!s.
 
7:42 PM
They are still keywords though, which I probably hate too much.
Great discussion, thanks!
 
I think func [[integer!] a [integer!] b [integer!] [x y]] lacks visual cohesion. When written this exact way, and not spreading the spec over multiple lines, I find it rather hard to quickly decide which block belongs to what. Similar to @HostileFork's regularly uttered gripe about " " " ".
@MarkI Only in the function specification dialect, though. But yes.
 
we should think along the line of object spec blocks and modules. E.g. modules definitely use set words:
stocks: module [
Title: "Stock Trading Module"
Name: stock-trade
Version: 1.2.0
Type: module
Exports: [buy sell]
][
buy: func [stock price] [...]
sell: func [stock price] [...]
]
 
@pekr I forget, in modules, are they arbitrary set-words or keyword set-words?
 
@pekr parse uses set-words in a way that differs from do.
 
@MarkI Keywords, of the module specification dialect.
 
7:50 PM
As @MarkI put it, the goal here is the elimination of keywords. It would be possible to still access the return word for definitionally scoped returns if you needed it with an accessor. But not laying claim to any words is good for something this foundational.
 
@earl So, not necessarily a conflict then.
 
@rgchris - and? I don't care about the so called 'do dialect. That is a valid argument. I am trying to find some similarities. If we use completly different meanings in various dialects, then we are doomed
 
I kind of like the lit-quoted parameters, but they may be trickier than they are worth.
 
@HostileFork That's completely unrelated to definitional return. Conflating return type specification and definitional return was a historic mistake, we have since been fighting hard to undo.
 
I mean - I know that we can use whatever here, but that imo does not mean, it should not be considered carefuly
 
7:52 PM
@pekr I don't see the proposed use in the function spec as being a radical abuse of set-word types.
 
@earl If you name a parameter (or local) return it is not unrelated to ask how you would get access to the definitional return for that function. If you wanted the dynamic return you could get it from the lib context.
 
@HostileFork If you name a parameter or local return, you shadow the definitional return.
 
func [local return return: [foo] local: func][...]
 
@pekr 100% agree, consistency across different usages is a valid concern, needs a good reason to be non-compliant.
 
Still rather unrelated to return: for return type specification.
 
7:54 PM
@earl There is no technical reason why shadowing a definitional return prohibit a mechanism for accessing it, any more than there needs to be a reason that overwriting print: not be able to fetch the original print function through some other avenue.
 
@HostileFork Sure, I'm not contesting that. You can use a reflector to access the shadowed function.
 
Module case I see as OK, there aren't even the concepts of **return** or **local** in a module spec/header, so no conflict.
Objects are similar.
 
@HostileFork I'm just saying that this is unrelated to return type specification or other function spec dialect "keywords".
 
There are concepts technical, aesthetic, and related to the mechanical processing of specs.
 
(Or, at least, not strongly related.)
 
7:57 PM
I think that using set-words as keywords is not all it's cracked up to be, and that more freedom with how locals are specified could be helpful.
>> source function
 
; Brought to you by: try.rebol.nl
function: make function! [[
    "Defines a function with all set-words as locals."
    spec [block!] {Help string (opt) followed by arg words (and opt type and string)}
    body [block!] "The body block of the function"
    /with "Define or use a persistent object (self)"
    object [object! block! map!] "The object or spec"
    /extern words [block!] "These words are not local"
][
    unless find spec: copy/deep spec /local [append spec [
            /local
 
Substitute local: for /local and then consider how looking for set-words is a much easier way to answer "what are your locals".
If you are tacking on a local you don't have to worry where things were left off, your specs don't end up starting local and then going to return and then going back to local again
 
@HostileFork I think @rgchris's parse rules for the spec dialect are a pretty nice and easy answer too.
I also think that ease of implementation should be slightly subordinate to easily readable specifications.
func [a: b [c] d: e f g:] [...]
Having locals collated at the end of the spec is actually an advantage, at least for my weary eyes.
 
Seems like a good idea, but then there's the "Rebol is a freeform language" idea. I might find it convenient while building to build it otherwise. The locals will be collated by help.
If the function is written by hand the conveniences are different than when written with code, with the good news being that if being written by hand you can choose what's most readable
 
It's not a completely freeform language. There's a function specification dialect which deserves a good design.
If you don't write functions to this spec, you are sheer out of luck.
 
8:03 PM
2 hours ago, by HostileFork
@RebolBot
foo: func [a [integer!] {a comment here} b {b comment here} [string!]] []
help foo
In that sense, I already don't want to allow a type spec after a comment.
 
Yep, part of the freedoms currently allowed by the dialect.
And even if you write specs with code, you'd probably have to be aware of the dialect anyway.
Typspecs for locals? Docstrings for locals? Allowed? Meaningful?
If you inject a set-word! local in between a parameter word! and its docstring ...
 
No, no, no, no. No.
 
With doc strings:
 
So if you have a spec [a [integer!] {a comment}] and want to inject a set-word! local, you already have to take care where you inject it. Otherwise you break or at least mess up the spec.
 
I was thinking more in the "you can always append a local". You might say you could do that by adding another local: blah blah and gather them but the spec-of is the spec as supplied.
So a composite would keep saying local: over and over instead of having a uniform solution.
 
8:10 PM
@rgchris comment and typespec are (currently) allowed to occur in any order.
(Gotta run.)
 
Noted. That'd make it a messier rule.
 
@rgchris I would vote only accepting typespec and then remark (which I already wanted to do before this)... though as it happens that's the way having the first block that occurs after no word be a typespec for return would work.
 
@HostileFork Not dismissing the idea, but I have a wee bit of a disconnect having the conclusion portion of the spec appear first.
 
@rgchris "The conclusion portion"? You mean you consider the return type to be the conclusion, vs. perhaps the first thing that should be mentioned?
 
Right.
 
8:17 PM
>> help append
 
; Brought to you by: try.rebol.nl
USAGE:
    APPEND series value /part length /only /dup count

DESCRIPTION:
    Inserts element(s) at tail; for series, returns head.
    APPEND is an action value.

ARGUMENTS:
    series -- Any position (modified) (series! port! map! gob! object! bitset!)
    value -- The value to insert (any-type!)

REFINEMENTS:
    /part -- Limits to a given length or position
        length (number! series! pair!)
    /only -- Only insert a block as a single value (not the contents of the block)
 
@rgchris If you look at that , where does the phrase "returns head" occur relative to the arguments and description?
 
At the end of the sentence first describing the action/arguments...
 
The description offers you a place to summarize the function in a general sense, and if you specified the return you could have a place to put the ending of that description and not need to mention it.
 
append: func [[series!] series [series!] value [any-type!]][...]
 
8:25 PM
USAGE:
APPEND series value /part length /only /dup count

DESCRIPTION:
Inserts element(s) at the tail of the input, splicing block elements by default.
APPEND is an action value.

RETURNS:
If the input was a series, the head of input is returned.

ARGUMENTS:
series -- Any position (modified) (series! port! map! gob! object! bitset!)
value -- The value to insert (any-type!)
@rgchris I'm used to C so int some_func(arg1, arg2) and it makes sense. But it would make more sense with a description. I guess I think it's learnable... the fact that people don't immediately guess what something means doesn't turn the language into needing to be object [field x: 10 field y: 20]. Some of the pieces are foundational.
 
Hm. You'd have ["Func Desc." [series!] "Return Desc." ... args] ?
 
@rgchris Yep, if you wanted to document your return, which today no one does because they can't.
 
I get that, but vs. ["Func Desc." ... args return: [series!] "Return Desc."]
 
Having return type as first argument doesn't make any sense. The natural flow is having function arguments first (they are input to the function), then local words (they are used inside the function) and return type as last (Rebol always returns last value).
 
@rebolek I see... so now you should specify your locals in the order in which they are assigned in your function?
 
8:30 PM
@HostileFork Hey, wait, I do that ... :)
 
@HostileFork It's not a requirement, but it makes sense.
 
foo: func [/local a b] [b: 10 a: 20] is wrong, but foo: func [/local a b] [a: 10 b: 20] is right, so we must design function specifications to match up with imperative ordering?
 
@HostileFork That is your idea, I never said that.
 
I just don't see the correlation between whether the first value in something specifying an interface has to be the last value in a function, especially when there are things like return and throw.
foo: func [[integer!] {demonstration code} a [string!]] [if 1 < 2 [return 10] more code more code but I already returned maybe]
 
Actually, if there's someone who's pushing for specific order in function specs, it's you with return type should be first.
 
8:36 PM
There are technically desirable outcomes from rethinking the idea of using set-words to be a new flavor of keyword/instruction in spec dialects, as well as it being a somewhat odd idea in general to use them for keywords.
 
So what's wrong with return: [integer!] ?
 
They are keywords with a set flavour: you are establishing locals, you are establishing a return type.
 
less than is wrong with local: x y z, because there is actually something bound in the body of the function called return...needed for definitional scoping.
 
@rgchris Not necessarily, doesn't it depend on FUNCTION implementation?
 
In any case, as it so happens on the stack, the return value is actually the first thing. Because the slot for the return value is pushed, then the arguments are pushed. At the end the arguments are popped, leaving only the return value.
Mechanically it does get specified before the arguments.
Which is not uncommon in the way such things are written, another reason you will probably find it many places.
I just take issue with this "it's better at the end" idea. It's not a mystery book.
Sometimes you want the conclusion described first. If we were to have to pick first or last I don't see anything less desirable about return being first...and there's at least an implementation-wise sound reasoning for it.
The thing one could argue would be better would be freedom of choice. I'm not sure freedom of choice is better in this case. But what does seem better is that for something as built-in as the function specification dialect, the set-word! type be used to more effect than 2 or 3 keywords...when using keywords in a foundational space like the spec has downsides.
network-function: func [remote [port!] local [port!] local: a b c d e] [...]
It's not good for local and it's not a good direction to be pursuing in general as "this is how we'll add keywords to the function spec dialect when they occur to us"
Are there worse ideas? Yes... /local is a worse idea.
But bear in mind here in this discussion there's a strong influence of "what you're used to". If you're used to one thing, the new thing comes along and looks strange. But if you turn your eyes toward other mechanics you might get more ideas...
object [a: b: c: d: 10 e: f: g: h: 20] wow, that's noisy-looking! So many set-words! We need object [#multiset [a b c d] 10 #multiset [e f g h] 20]. Whew, now it's much more readable, got rid of those ugly set-words!
We've already found that in general, with function, people are wanting it as behind the scenes anyway.
So the discussion might focus more on other questions, like "how to make things come from the outer context". Maybe they're get-words, and maybe lit-word retakes quoting and does the full quote that get-word does today.
Anyway, it's an idea and the question is to think about it with an open mind and try running ideas through their paces a bit. There's a lot to consider and the only real testing that set-word: has gotten in function specs is return: in Red. I was the one who suggested local: because of it, and in implementing some of it I'm not necessarily happy with the general idea.
 
8:54 PM
FWIW in my keyword-free example, we could always allow keywords and ignore them, like func: [[/return integer!] a [integer!] b [integer!] [local: c d]][return 0]. Et cetera.
 
@MarkI I just don't like the "blocks can mean typesets OR something else"...specs should be simpler than that.
 
Allows users to have fun, [/gives-back integer!], [/hidden-in-scope c d]
 
We don't do fun here.
(under that definition, at least :-P)
 
@HostileFork We actually already have that, blocks only mean typesets after a parameter word ...
 
Also an option that the core function type (func) uses keywords and the common constructor uses dialect that perhaps precludes some uses: function [typeset! | arg1 arg2 ...]
 
8:59 PM
Well I've got to take off, but perhaps this can be continued to be thought about. My goal is a playground where these things can be tested on real codebases and improve the reliability and modify-ability... and... I will get back to that goal... soon
@rgchris When adding blocks and strings for annotations that vertical bar might get lost in the noise...
In any case, interesting stuff... l8r...
 
Good to have your input HF, cu.
 
00:00 - 19:0019:00 - 22:00

« first day (1653 days earlier)      last day (2127 days later) »