|
Pages: [1]
|
 |
|
Author
|
Topic: "first", "second", "third" -- hidden eff (Read 2501 times)
|
-X-
Guest
|
I noticed that the pre-set REBOL/core words "first", "second", "third" seem to also be used for listing various groupings of content within a function (or whatever).
I desire to unset all the "ordinal number" pre-set words, but there seems to be a dependancy of these 3 words in particular. Also, I would guess that having such side effects, or series postion effects, (depending on which component of the function is desired) would slow evaluation to some degree. Is this true?, or is the data or data similarities such that no effeciency is lost in the duel interpretation of the 3 words?
Also, I glanced a pre-set word called "extract", which, on the basis of what it generally seemed to imply, sounded like it might be a function by which such behaviors as listed above as might be coded (assuming the pre-set words utilized a similar data structure as in the example for "extract", the one found using REBOL/view "Word Browser") ...
Any advice or pertinence, as to this?
|
|
|
|
|
Logged
|
|
|
|
|
Gabriele
|
I desire to unset all the "ordinal number" pre-set words Don't do that.
|
|
|
|
|
Logged
|
|
|
|
-X-
Guest
|
Why not? The "ordinal number" functions waste space on the command listings, and can be used with 'pick or series! paths instead. I'm not removing functions such as 'head, 'tail, and so forth. which is longer?: seriesvar/1 or first seriesvar The word "first" also implies a sense of occurence, which such implication only applies sometimes, thus it produces potential for ambiguity of interpretation (confusing the programer or user). A similar example of naming ambiguity is the function 'do. If I were to ask you to "do your lawnmower and its instruction manual" how would you interpret that? Thus, I have assigned the function of 'do to a new word named 'invoke. compare the clarity of the following: invoke [2 + 7] invoke [%editor.exe] invoke [ v1: make integer! 7 print to-binary v1 ]
versus do [2 + 7] do [%editor.exe] do [ v1: make integer! 7 print to-binary v1 ]
"do" implies only the aspect of action execution, whearas "invoke" implies establishing a basis (if applicable) and then enacting it. Using "invoke" reminds the programer/user of what they are actually programming the computer to perform. It also makes more sense in a metaprogramming capable language than "do" does (ie: writing content of blocks to be invoked as individual mini-programs, as it were). Back to the "ordinal numbers". If indeed there are hidden effects within any of the functions I modify, assuming they reduce efficiency, then I will, of course, provide new methods by which those particular side effects may be invoked or accessed.
|
|
|
|
|
Logged
|
|
|
|
|
Sunanda
|
Why not? Because large chunks of REBOL itself is written in REBOL (the functions of that sort are caled mezzanines) and many use first, second, etc. Take a look for yourself: write %rebol-system.txt mold system true Then open rebol-system.txt in an editor and take a look around. Sunanda
|
|
|
|
|
Logged
|
|
|
|
|
Gabriele
|
Because FIRST is an action, and only apparently the same as PICK ... 1.
Unsetting them is not going to save you memory, btw, and you are not forced to use them with series if you don't like them.
Anyway, if I understand what you are doing, you are just creating your own language; that's fine, it'll just be another dialect of REBOL. However, consider that Carl spends a lot of time just on naming issues; I don't see as INVOKE is a better name than DO for example, actually it seems completely off to me; I might consider invoke for a function that calls another function ("apply" is its canonical name), but not for DO.
|
|
|
|
« Last Edit: February 13, 2006, 07:29:11 AM by Gabriele »
|
Logged
|
|
|
|
-X-
Guest
|
:angry: Yes, I already knew that the "ordinal" functions were used in some of the REBOL source code for some functions. But if you used the SDK to edit the source code so that the alternative functions (ie: pick, etc) were used instead then it wouldn't really matter that the "ordinal" functions were once used in the source now would it? (assuming efficiency is equal, and assuming alternative methods of coding any unique side effects the fuctions once had is provided) If it's a matter the altenative methods to the "ordinal" functions being less efficient for reasons of their own source code extensiveness, then you could probably modify them to make them more narrow, deterministic, and quicker. On certain posts on this forum I read recently it states that, for example, using the "mezzanines" tends to be much slower (approxiamatly double time required in one example they showed) than the native functions. If the "mezzanines" are written in terms of invocations of the native functions, surely you would not be so naive as to think that they could not be modified as desired (by recoding them via the native functions)? Is it not corruptive of the purpose of language dialecting to force programmers/users to include redundant functions they they do not even want in their code? What sounds like it has more potential for use?: a function that returns a series! value of (in theory) any postiver integer index, or a function that returns a series! value confined only to the indexes 1 through 10. (assuming both have equal efficiency of execution) when I said, in my first post for this thread: , but there seems to be a dependancy of these 3 words in particular I was referring to the functions "first", "second", "third" being used as some sort of listing function as well as a series! value returner, as well as to my already having seen the "oridinal" functions being used in certain functions (which I had found via the 'source function), though I probably could have been more clear that such was the case, as it were. <_< This matter of removing such useless redundancys as the "ordinal" functions, is not one I'm willing to compromise on, unless you can prove that the "ordinal" functions are not redundant and serve a purpose that would not be made better by removing them and recoding any side effects within as additional functions (if applicable). _
|
|
|
|
|
Logged
|
|
|
|
|
Sunanda
|
useless redundancys as the "ordinal" functions One person's useless redundancy is another's prefer alternative syntax: print "hello" is redundant as it could be: prin ["hello" "^/"] append myseries 1 is redundant: insert tail myseries 1 probe is print mold attempt is basically error try And so on. Some of the "redundancy" is due to short-hand notions introduced in later versions. Sunanda
|
|
|
|
|
Logged
|
|
|
|
|
Sunanda
|
Additionally, there are instances where pick and ordinal embody differemt behaviour: my-obj: make object! [a: 1 b: 2 c: 3] same? first my-obj pick my-obj 1 same? second my-obj pick my-obj 2 same? third my-obj pick my-obj 3
Sunanda
|
|
|
|
|
Logged
|
|
|
|
-X-
Guest
|
:blink: ------------------------------------------------------------------------------------------------------------------------- (from post #3 of Sunanda) Additionally, there are instances where pick and ordinal embody differemt behaviour ...I said that already...not only was that more than half the subject of the thread... but I refered to it at least 3 times...see: (from post #1 of -X-; me) I noticed that the pre-set REBOL/core words "first", "second", "third" seem to also be used for listing various groupings of content within a function (or whatever). (from post #2 of -X-; me) Back to the "ordinal numbers". If indeed there are hidden effects within any of the functions I modify, assuming they reduce efficiency, then I will, of course, provide new methods by which those particular side effects may be invoked or accessed. (from post #3 of -X-; me) I was referring to the functions "first", "second", "third" being used as some sort of listing function as well as a series! value returner, as well as to my already having seen the "oridinal" functions being used in certain functions (which I had found via the 'source function), though I probably could have been more clear that such was the case, as it were. I also stated a guess as to what I thought may be a method by which the quote "different behavior", as you said it, may be coded, separately (thus better capable of augmentation as parts of new uses and names, to whatever degree the user wants): (from post #1 of -X-; me) Also, I glanced a pre-set word called "extract", which, on the basis of what it generally seemed to imply, sounded like it might be a function by which such behaviors as listed above as might be coded (assuming the pre-set words utilized a similar data structure as in the example for "extract", the one found using REBOL/view "Word Browser") ... ------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------- (from post #2 of Sunanda) One person's useless redundancy is another's prefer alternative syntax I understood that, and I did not intend to inhibit alternative capablility in any way. For an example of what following your statement (implication) would be like at an extreme: What if whenever you bought a book, every single line was followed by an equivolent translation, one for every language on Earth? Suppose, since various languages may differ significantly, that there exists no method in such circumstances that you can judge when the next line that is of your language is? It would slow you down wouldn't it? Forcing a hybrid does not solve difference of preference, because, potentially, not everyone would prefer that hybrid to be present. When you mix iron and carbon you don't get a substance that can be used exactly as iron or exactly as carbon, you get steel alloy. ------------------------------------------------------------------------------------------------------------------------- I'm a bit supprised, I had expected more explanation of reason. ...This does however, remind me of a thread I once had for WarCraft 3, a while ago, which pertained to how I could find the identifying names that linked to individual instances of the game's "hotkeys". Here's how it went (and I'm para-phraseing): - I posted my question - replyer #1: "altering the hotkeys is punishable hacking" - me: "open your WarCraft 3 install directory, read the text file, included with every retail install of the game, that states that your allowed to change them and how to do it" - replyer #2: they agreed with replyer #1 that "altering hotkeys is punishable hacking" - me: "no, it's not, just open the text file included with the retail game and you'll see it's not" - replyer #1: "I hate hackers" - replyer #2: "meee toooo!" - (it went on like this for a while) - then, finally; replyer #3: "open the map editor, open the object menu, click preferences under menu x, toggle checkbox 'use original names', return to the object menu list, there you will now find all the names, each referencing what it pertains to" Guess which replyer I liked most from that story... oops, I just noticed Gabriele's 2nd reply, so sorry if that caused any confusion, cause I hadn't seen it until right after finishing the above writingAhh, "unset won't save me memory"? I've been curious about that function in any case, so...what exactly does it do? Does the memory ("garbage") collector clear the memory as soon as the word is marked in some way? How exactly does the marking work (is it limited to the "assigning to 'none " and "unset"), or, what exactly is the situation? What about if you remove the functions via use of the SDK (or whatever), will it still not save memory?
|
|
|
|
|
Logged
|
|
|
|
|
Gregg
|
(late reply to this thread, I know)
I think Gabriele and Sunanda were trying to do was keep you from spending time on something that seems of little value. It may be valuable to you, but we only have limited info to go on about why it might be so.
Anyway, you're probably not going to save any memory at all by unsetting the words. If you do save *any* memory, it will likely be such an insignificant amount that you'd never know it.
Since you can't, even with the SDK, change the behavior of natives, you're not going to be able to gain any speed either. If there was a compromise to be made, RT made it already and decided to overload those ordinals anyway. Now, since R3 is in development, maybe you can convince them to revisit that decision, but it would probably break a lot of code.
What you do for your own code is entirely up to you of course, but I don't think you'll gain much from this either. Just my two cents.
|
|
|
|
|
Logged
|
|
|
|
Carl
Global Moderator
Newbie
Offline
Posts: 18
Carl Sassenrath, designer of the REBOL Language.
|
Wow, a lot of chat on this topic.
Yes, you can use PICK instead. That works fine, however, it turns out the ordinals use very little code and:
first list
takes less memory, and is probably faster than:
list/1
In REBOL 3.0, the ordinals will work differently due to the new separation between system and user namespaces. (So, in fact, you will be able to unset them without affecting the system code.) In addition, they will be natives, not actions (i.e. they are abstracted over all series, not methods for each series.)
|
|
|
|
|
Logged
|
-Carl, the REBOL guy.
|
|
|
|
Gabriele
|
- I posted my question - replyer #1: "altering the hotkeys is punishable hacking"
Noone's saying that, we're just saying (as Greeg pointed out) that there's no advantage in doing what you seem to be doing. If you're just changing the name of functions to something you like more, that's fine and you're completely allowed to do that, but then your scripts will only work for you. Ahh, "unset won't save me memory"? I've been curious about that function in any case, so...what exactly does it do?
It sets a word to the UNSET! value. It's the same as SET/ANY 'WORD () or (SET/ANY 'WORD). Now, if the value that was referred to by that word has no more references, the GC will eventually free it. But, you cannot really free actions or natives, since their code is native executable code in the REBOL exe.
|
|
|
|
|
Logged
|
|
|
|
|
|
Pages: [1]
|
|
|
 |
News: 01-09-08 Alpha version of REBOL 3 has been released!
2234 Posts in 582 Topics by 1745 Members
Latest Member: vectlycle
|