World: r3wp
[!REBOL3-OLD1]
older newer | first last |
[unknown: 5] 21-Jan-2009 [9822x4] | So can specify how many blocks of data you want to read at a time? Like say I want to read 10 blocks and stop and then read 10 more where that one left off? |
Sorry I got distracted - I had to use some mighty puddy on a chair. | |
I have a function called get-block which I use to handle block reading currently. | |
It can be used on binary data as well as ascii data and will carve out the blocks of the buffer. | |
Henrik 21-Jan-2009 [9826] | It seems rebdev mobile is down right now, so I made a screenshot of Steeve's example post: http://rebol.hmkdesign.dk/files/r3/gui/182.png |
[unknown: 5] 21-Jan-2009 [9827x3] | >> a: "this is a test [now a block] garbage [another block with a block in it []][and another] garbage.. == {this is a test [now a block] garbage [another block with a block in it []][and another] garbage..} >> get-block a == [now a block] >> get-block a == [another block with a block in it []] >> get-block a == [and another] |
My get-block function just advanced automatically through the string. | |
anyone know which sort algorithm that R3 uses for it's sort function? | |
Steeve 21-Jan-2009 [9830] | Paul, yes i do by using the standard copy/part function. >> copy/part v-block 10 == [ first-value second-one etc...] copy is auto advancing in the block, so that if you do several copy/part at once , you will get several sub blocks of values. |
[unknown: 5] 21-Jan-2009 [9831] | So 10 would equal ten blocks read? |
Steeve 21-Jan-2009 [9832] | yes |
[unknown: 5] 21-Jan-2009 [9833] | Can it handle newlines in the block contents? |
Steeve 21-Jan-2009 [9834x2] | it works in reverse order either. >> copy/part tail vblock -10 get the last 10 values of the block |
Yes Paul, it does | |
[unknown: 5] 21-Jan-2009 [9836x2] | Good, it is sounding nice Steeve. Hope to see it in R3. |
Yours sounds like what Chris wants to do. | |
Steeve 21-Jan-2009 [9838] | even it it's not in core R3, it will be downloadable. |
[unknown: 5] 21-Jan-2009 [9839] | Nice Steeve. |
Steeve 21-Jan-2009 [9840] | i will release the first version in some days or hours, i need to write more documentation |
[unknown: 5] 21-Jan-2009 [9841] | Please post in ALTME as well. I would like to check it out. |
Pekr 21-Jan-2009 [9842] | rebdev private msging fixed .. |
[unknown: 5] 21-Jan-2009 [9843] | Will R3 introduce function overloading? |
BrianH 21-Jan-2009 [9844] | Nope, functions are still values. |
[unknown: 5] 21-Jan-2009 [9845] | ok.. |
BrianH 21-Jan-2009 [9846] | Which is incompatible semantically with overloaded functions. You can only overload functions in languages where functions are declared, not where they are constructed and assigned. |
[unknown: 5] 21-Jan-2009 [9847x3] | Correct, how about default parameter values when no arguments are passed and a function is invoked? That would be a nice feature to have. |
We can do this now in a more complicated manner. | |
I guess that could be related to the declaration issue also though. | |
BrianH 21-Jan-2009 [9850x2] | No, that's feasible in theory, but only for arguments that are optional in the REBOL style, using refinements (or any-type! for the last arguments) - REBOL's evaluation model depends on knowing the number of arguments. In practice the current method may be more efficient - we can see. That could be handled by a function construction function, i.e. FUNC, HAS or DOES. |
Declaration is not the issue here, it is the lack of parentheses. | |
[unknown: 5] 21-Jan-2009 [9852] | We can currently do default values in R2. |
BrianH 21-Jan-2009 [9853] | Yup, likely using the same function construction functions as R3 if you like. Unlike FUNCT and FUNCTOR, that problem doesn't sound like it would require anything new to make things easier. |
[unknown: 5] 21-Jan-2009 [9854x3] | I can already do something like this: fnc: func [a [unset! string!]][either value? 'a [a][a: "I got value"]] |
but it would nice to be able to do something like this: fnc: func[a [string!] /default $10 ][print a] fnc >> $10 | |
where anything after /default is a default value for the respective parameter. | |
BrianH 21-Jan-2009 [9857] | Note that your parameter was the last in the list, the second condition mentioned above. That would only work if the calling expression was the last in its block because of REBOL's evaluation rules. |
[unknown: 5] 21-Jan-2009 [9858] | Which is even more reason why the second example would be preferred. |
BrianH 21-Jan-2009 [9859] | The evaluation rules of REBOL can't change without requiring parentheses or something around function arguments. |
[unknown: 5] 21-Jan-2009 [9860] | I didn't know how deep changes were being made with respect to R3. Maybe a wish for R4. |
BrianH 21-Jan-2009 [9861] | Default values for parameters that are not the last parameter would need to be made optional using refinements. You *really* can't change this, not even in R4. |
[unknown: 5] 21-Jan-2009 [9862] | Seems odd to me. What language is REBOL written in? |
BrianH 21-Jan-2009 [9863] | C and REBOL, with some C++ in linked libraries (AGG). |
[unknown: 5] 21-Jan-2009 [9864] | Then it is doable from that standpoint - must be another reason that it wouldn't be done. |
BrianH 21-Jan-2009 [9865] | It has nothing to do with the implementation language though - it's a syntax thing. |
[unknown: 5] 21-Jan-2009 [9866x2] | In C++ for example the defaults are set as follows: int fnc (int x = 1 int y = 2){...} |
I can understand the syntax issue from the perspective of it requiring the parameters defaults be ordered. | |
BrianH 21-Jan-2009 [9868] | Languages that wrap function arguments in parentheses (like C and Pascal) or are line-oriented (like Basic and Python) or at least have statement separators (like ; ) have a way of telling where their argument lists end. REBOL can only do so if the arity of a function is determinable at the call site. This is the price we pay for getting rid of the parentheses. |
[unknown: 5] 21-Jan-2009 [9869] | Yeah, I wish Carl would give more specifics on the internals sometime. |
BrianH 21-Jan-2009 [9870] | That is not a matter of internals, it really is a consequence of REBOL's evaluation rules. You can't change it without changing the language in drastically incompatible and slower ways. |
Steeve 21-Jan-2009 [9871] | Ok, i made a demo using the virtual block scheme (tested only with the last alpha) Sorry for my frenglish http://www.MegaShare.com/573256 |
older newer | first last |