World: r3wp
[Core] Discuss core issues
older newer | first last |
BrianH 8-Oct-2011 [2370] | I'm OK with not having a /with, but I'm sold on having an APPLY-style /only option. |
GrahamC 8-Oct-2011 [2371] | That sounds tricky ... if you're reading two input streams .. to substitute ... you need to know when a %n is intended not to be replaced |
BrianH 8-Oct-2011 [2372] | What if "%%" was always interpreted as "%"? Then the way that you signify %n as not being a replacement is to write it as %%n. |
GrahamC 8-Oct-2011 [2373x2] | This is what happens in MS dos |
shell | |
BrianH 8-Oct-2011 [2375x2] | Yup. |
The main advantage to APPLY reducing its argument is that it doesn't necessarily have to allocate an intermediate block. This might be tricky though if you want to implement SUBSTITUTE as a command. Can you DO/next in a command? | |
GrahamC 8-Oct-2011 [2377] | And I guess my next question is, do you really need "n" ? Why not prepare the arguments in order and just use them as in SQL dialect? |
Ladislav 8-Oct-2011 [2378] | The current proposal allows me to write: ["%%1" "%1"] to obtain the "%%1" string. With your proposal I would need to write it as ["%%%%1"] , so, I do not think I gain any advantage. |
GrahamC 8-Oct-2011 [2379] | Yes, it's more flexible |
Ladislav 8-Oct-2011 [2380] | Why not prepare the arguments in order - that is not suitable for translation |
BrianH 8-Oct-2011 [2381] | Graham, the %n method supports switching template strings between languages with different sentence ordering. |
Ladislav 8-Oct-2011 [2382] | (thranslation should be able to adjust the order according to the language requirements) |
GrahamC 8-Oct-2011 [2383] | Sounds then the cases are quite different and should have different functions |
BrianH 8-Oct-2011 [2384x3] | Ladislav, the advantage would be that you don't have to allocate a substitution argument for that % escaping, especially if some of your template strings might need a %1 in them and others might not. |
I am thinking of the code-generation posibilities, where instead of Russian you are generating ASP or something. | |
Or RSP if you like. | |
Ladislav 8-Oct-2011 [2387] | the advantage would be that you don't have to allocate a substitution argument for that % escaping - yes, understood, I was originally for that alternative, but, Cyphre convinced me, that for human writers, actualy the substitution is more readable |
BrianH 8-Oct-2011 [2388] | Ah, sticking to the natural language translation usage model, even though you are allocating a more generally applicable name to the function. |
GrahamC 8-Oct-2011 [2389] | substitute ( "%1" "translate" ) |
Ladislav 8-Oct-2011 [2390x2] | Well, yes, the name may be conflicting, sure |
But, "translate" is not a good name, since the translation is what is being performed as well, besides the substitution | |
BrianH 8-Oct-2011 [2392] | Well, given my current business needs I would use SUBSTITUTE more for code generation than for translation, but it would be useful for generating English as well. |
Ladislav 9-Oct-2011 [2393x3] | Sure, I expect there *are* other uses. As for the %% case, I am still not sure, it might be intersting to know what would Robert prefer. |
In general, I do not expect the #"%" character to be contained in the texts being followed by a digit. At least not frequently enough to normally matter. | |
But, sure, in strings that are not meant to communicate something to humans, the frequency of "%" may be higher. | |
Ladislav 10-Oct-2011 [2396x3] | Hi, I found the following text part in the Replacement article: "ENLINE any-block!,". Forgive my ignorance, please. What exactly is ENLINE meant to do in case its SERIES argument is a block? |
I am especially curious, if it really qualifies as non-modifying function in that case. | |
aha, nevermind, I just used some tests to find out what it does | |
BrianH 10-Oct-2011 [2399] | I really wish the ENLINE/with ticket would be implemented. I could use this function daily. |
Ladislav 12-Oct-2011 [2400x2] | In R3 we have got the system/state/last-error , which is great for convenience. Is there a corresponding variable in R2? |
If it does not, it would be great to have this feature backported... | |
Geomol 12-Oct-2011 [2402] | Today's Moment of REBOL Zen: >> s: "A" == "A" >> lowercase s == "a" >> s == "a" >> c: #"A" == #"A" >> lowercase c == #"a" >> c == #"A" |
Ladislav 12-Oct-2011 [2403x2] | :-) |
I hope you know why? | |
Geomol 12-Oct-2011 [2405] | Yes, I do. And I'm thinking, if it would be an idea to let functions like that take word arguments handling them like call-by-reference. Then it would be possible to change chars too. |
Endo 12-Oct-2011 [2406] | You mean also >> i: 5 == 5 >> multiply i 4 == 20 >> i == 20 (?) |
Geomol 12-Oct-2011 [2407x2] | That would be multiply 'i 4 then. Maybe not too useful in that case. Or though, the ++ operation (function) could use this too. Which then reminds me, that NEXT should be used for what ++ does. :) |
There was a discusson in Carl's blog about this long time ago. | |
Endo 12-Oct-2011 [2409x2] | move-next 'series looks ok but multiply looks weird. but ++ already works for series as you say. |
++ : "Increment an integer or series index." | |
Geomol 12-Oct-2011 [2411] | Has anyone said the following before? call-by-word |
Endo 12-Oct-2011 [2412] | I didn't hear that before. |
Geomol 12-Oct-2011 [2413] | I suggest: skip ++ and use NEXT with call-by-word to do the same. Less functions to remember that way. |
Endo 12-Oct-2011 [2414] | using NEXT with call-by-word (I like the name :) ) looks ok to me, but I remember that, "guru"s may say "it leads performance overhead for next, as it is a native and used a lot. it should check the argument and get-value if it is a word." |
Geomol 12-Oct-2011 [2415x4] | I'm not too sure about additional overhead, depending on how NEXT is implemented today. My guess is, NEXT already test for different datatypes, as it can handle blocks, strings, etc. To in that SWITCH (guessiong) in the source code, it just have to include the word! type also and handle that, and default: give the error. |
To -> So | |
and *guessing* :) Getting late = more typing errors. | |
Then we could have things like: >> a: 41 >> next a == 42 >> a == 41 >> next 'a == 42 >> a == 42 | |
Endo 12-Oct-2011 [2419] | NEXT already test for different datatypes, as it can handle blocks, strings, etc. But it's all series type. So no type checking I think. It supports only series and port values. |
older newer | first last |