AltME groups: search
Help · search scripts · search articles · search mailing listresults summary
world | hits |
r4wp | 1023 |
r3wp | 10555 |
total: | 11578 |
results window for this page: [start: 4601 end: 4700]
world-name: r3wp
Group: Core ... Discuss core issues [web-public] | ||
Graham: 5-Oct-2005 | the alternatives are .. 1. I learn to do it properly each time 2. I change the language to do it the way I expect :) | |
[unknown: 5]: 5-Oct-2005 | At work we have an issue with supporting extremely large pst (outlook personal folder files). The issue is that we wont to make sure these files get backed up when the sales force connects with the network. Problem is that the M$ solutions built into Windows XP cause problems because if it sees a changed file it then trys to copy the entire file - I believe this to be the case with offline folders files and briefcase files also. What I would like to see is a solution whereby only certain contents of the file detected as changed are copied over the network and update the master file. It occurred to me that this should be a capability of any X-Internet application that deals with significant file sizes. So my question is - does anyone know of any method's, algorithms or such that currently do such work? | |
Sunanda: 5-Oct-2005 | Thanks.....Obviously, it'd be much faster to run as a native. But it may be much faster to develop as a mezzanine -- and would be (with a little care) backward compatible with existing and older versions of REBOL. What would be useful is some agreement on the dialect......The RT could schedule work on the native while others do it mezzanine as a usual (and b/w compatible) prototype. | |
Pekr: 6-Oct-2005 | also, e.g. - how to easily "form decimal"? E.g. doing 1 / 100 returns 1E-2 ... why? Imagine you need it to output to some file - e.g.I do some money conversions .... 1E-2 imported into some DB is really not helpfull. So I wrote form-decimal function myself, but it is weird anyway .... | |
Pekr: 6-Oct-2005 | dunno ... you simply has some computation, it returns the result ... and result may be something like 1 / 100, and you suddenly end-up with 1E-2, now what to do with that? | |
Pekr: 11-Oct-2005 | btw - what you think of following? - normally we can access paths in several ways ... block/5 (fifth element), block/literal (literal element), block/(expression) (expressionn to evaluate). Nonexistant elements do return 'none. But try block/("some string") - it returns error. Now the question is, if this is correct/consistent with other ways of how we access block elements, or not? | |
Geomol: 15-Oct-2005 | I think, this version do the job: form-decimal: func [n /local p d] [ if p: find n #"E" [ if d: remove find n #"." [d: index? d p: back p] if not d [if d: remove find n #"," [d: index? d p: back p]] if not d [d: 2] either p/2 = #"-" [ insert/dup n #"0" (to-integer skip p 2) - 1 insert n "0." ][ insert/dup p #"0" (to-integer next p) - (index? p) + d ] clear find n #"E" ] n ] | |
Geomol: 16-Oct-2005 | Louis, I'm doing something similar as Henrik with a DB, I made in REBOL a couple of years ago. A REBOL task is listening on a TCP port and is handling the multiuser functionality. The clients could update the data in the DB themselves, or a task could do that too. My DB (NicomDB) isn't a product yet, but I could make it a product, if you're ready to pay for it? | |
Louis: 16-Oct-2005 | Geomol, let me see what I can do myself first. I like to know what is happening in my scripts. | |
Geomol: 17-Oct-2005 | I guess, it has to do with the internal floating-point representation of numbers. | |
Pekr: 21-Oct-2005 | will it be possible to do easy types conversion with rebcode? regard me being stupid, but I regard following being bug or at least inconsistence: type? #{77} == binary! ; so no excuse it is a string later! to-integer #{77} == 119 to-binary to-integer #{77} == #{313139} | |
Chris: 21-Oct-2005 | How do you change the content type of outgoing emails? I want to change the charset to UTF-8... | |
Gabriele: 22-Oct-2005 | SEND does not take the recipients from the header, so it has no reason to preprocess it. if you include a BCC header, it's because you want it to pass... otherwise, why do you include it? | |
Tomc: 22-Oct-2005 | and when you do send to a bock of addresses they are send as individual messages (effecively a BCC) | |
Gabriele: 23-Oct-2005 | the user interface for mailers, though, of course do more than that. TO, CC and BCC are part of the user interface. | |
Graham: 24-Oct-2005 | Quick question .. how do you set the century to-date defaults to ? >> to-date "1/10/40" == 1-Oct-2040 is not what I want. | |
Graham: 24-Oct-2005 | because although I can do it, someone else may not be able to do so. | |
BrianH: 24-Oct-2005 | Ladislav, I did notice. I'll do it later, after I get some sleep - I want to think about the phrasing. | |
Ladislav: 24-Oct-2005 | Pekr: don't, I wanted Bryan to do it on purpose | |
BrianH: 27-Oct-2005 | From a philisophical standpoint, it is best to be somewhat forgiving in your evaluation of the syntax of data that is input to your function, but exact in the syntax of the data that is ouput from your function. That will make sure that the effect of errors or flexibility in the data is limited to the code that is doing the initial evaluation. This means that if you can figure out from context what a default value is, do so, and then your function will be more usable, particularly when the data may be written by hand. | |
Volker: 30-Oct-2005 | path seems to be a "clear find". Do not know about uses. | |
Gabriele: 31-Oct-2005 | path is internal, and should probably not be exposed. my guess is that it has to do with path evaluation. | |
Geomol: 1-Nov-2005 | I had a problem with SWITCH, and it turned out to be a funny thing with SELECT (see source switch). If you've got a block like this: blk: [1 word "string" 1.2 01:00:00 1-11-2005 any-type! 4] you can do things like this: >> select blk 1 == word >> select blk 1.2 == 1:00 >> select blk 'word == "string" >> select blk 1:00 == 1-Nov-2005 >> select blk 1-11-2005 == any-type! And now the fun (or strange) part: >> select blk any-type! == word It's possible to select on a datatype. The first element in the block (1) is of type any-type!, so I get: word. It's possible to do things like: >> select blk date! == any-type! >> select blk time! == 1-Nov-2005 So how do I select a datatype in a block? I could do this: >> select blk to-word any-type! == 4 or something like this: >> select reduce [file! 1 url! 2] url! == 2 I can cope with this in my code, just found it peculiar. | |
Geomol: 1-Nov-2005 | In the last part, what I'm trying to do, is selecting a datatype word in a block. | |
BrianH: 4-Nov-2005 | A lot of the time I do my dialect processing with functors, functions that create functions. Sometimes these functors run in pre-rebol, some at runtime function creation time. Then the actual work is done by the generated functions. This gives me the advantages of dialects without the drawbacks. On the other hand, dialects like draw are examples of my principle of low overhead in proportion to the that of the work performed - the dialect overhead isn't that much different to that of a series of function calls in the do dialect. | |
Louis: 5-Nov-2005 | Do you have a link to some how to info? | |
DideC: 5-Nov-2005 | Sorry I don't understand what you want to do :-\ | |
Gordon: 5-Nov-2005 | I want to be able to pass the function another value which equals the number of elements in a record and then do something like Record: array {Elements} | |
BrianH: 5-Nov-2005 | Sunanda, do you mean sort on the second field? Try passing an integer or block of integers to the compare refinement of sort. | |
Sunanda: 5-Nov-2005 | Stable is to do with the order in which duplicate keys are returned. | |
JaimeVargas: 16-Nov-2005 | I think I can contruct CONS myself. But I was wondering if we could do it just with rebol constructs. I would also like to see you CONS. | |
Anton: 24-Nov-2005 | Pekr, you can do it by binding your 'date-lay to the 'date-lay that is already in the function body. insert second :request-date bind [probe date-lay] pick pick second :request-date 10 2 (Mmm... request-date is quite an ill-behaved function. It sets 5 words in the global context.) | |
Graham: 27-Nov-2005 | if you wish to parse a literal which changes ... how would you do that? parse phrase [ 'literal ] can't be done this way parse phrase compose [ '(literal) ] | |
Anton: 27-Nov-2005 | What makes you want to do that, though ? | |
Volker: 27-Nov-2005 | Or do you want to catch any lit-word? | |
Henrik: 28-Nov-2005 | do-a-function either condition ['ref][none] <arguments> as opposed to the clumsier: either condition [do-a-function/ref <arguments>][do-a-function <arguments>] | |
Geomol: 28-Nov-2005 | You can do this: do to-path reduce ['do-a-function either condition ['ref][none]] <argument> but if it's less clumpsy, you deside! | |
BrianH: 29-Nov-2005 | ; Try this way, no reduce or to-path... do either condition ['do-a-function/ref] [:do-a-function] <argument> | |
Rebolek: 12-Dec-2005 | Because I'm writing scripts on more than one computer I need to sync files somehow. I can use flashdisk for synchronization, but USB is not always available or I forget my flashdisk at home, so it's not always the right option. Or I can use ftp to upload and download files. But at the end I've got lots of different directories with different versions, because I have no intelligent file structure. I was inspired by Google filesystems for win and lin so I decided to use some freemail (gmail preferably) for my scripts maintaing. Unfortunatly, Gmail needs some authentication, SSL or what and SSL under Rebol needs Command and Command needs 350$ to buy. So I found another freemail provider that offers both non-authenticated SMPT and POP and therefore is OK for REBOL (btw. remeber the old REBOL example? send [luke-:-rebol-:-com] read http://www.rebol.com? Hard to do with all the authetications required today.) and I started coding. The result is a small application called %rspace.r that can upload file to repository, download newest version from repository, or you can get list of all files in repository and finally, if you're happy with your script, you can publish it on www/ftp. All this with documentation in less than 6kB. All you need is REBOL and mail account cappable of SMTP/POP without authentication. It's good to have an FTP account for publishing files but that's not required. If you do not have an mail account, I've set up one on seznam.cz, user 'rebolspace' and pass 'spacerebol' for testing this application (it's built in, so you can start testing right after download). Remember, it's just alpha, does not have many features, but it works, I can write something here, update it there and have all the versions accesible from everywhere. It's written for REBOL scripts so with big projects it's going to be very slow and unusable, but for small project (and most REBOL scripts are really small) it's probably good. So download it form http://krutek.info/rebol/rspace.r(stable) or http://rebolspace.sweb.cz/rspace.r(latest published version). WARNING: because [rebolspace-:-seznam-:-cz] is open account it won't be wise to use it ordinarily. Please, if you like it, set up your own account and use it instead of built-in one. And remember: all suggestions and fixes are welcome. | |
MichaelB: 13-Dec-2005 | can somebody give me a quick rule, why the pick-path notation evaluates it's picked value and pick does not (and first...) (as it should be a shorthand for pick) as in: bl: [] append bl func [a][print a] bl/1 "hello" ;evaluates the function pick bl 1 "hello" first bl "hello" ; both do not I have to do an extra 'do - I'm just curious for a reason ?! | |
Geomol: 13-Dec-2005 | The explanation might be, that it should be possible to get the function without evaluating it. You can do that with PICK or FIRST: f: pick bl 1 f: first bl Now if bl/1 worked the same way, you always had to add DO to get it evaluated. So my guess is, Carl desided, that wouldn't be too smart, and I agree. It's the same with objects. To call a method (a function) within an object, you just write: o/some-func No DO is needed in front of that. So using path notation to get to a function within a block or an object will evaluate the function. | |
Terry: 27-Dec-2005 | exactly.. like I've got nothihg better to do than build a webserver in Rebol that can handle POST data.l.. | |
Ladislav: 27-Dec-2005 | like I've got nothihg better to do than build a webserver in Rebol that can handle POST data - I have seen nothing capable of convincing anybody such a webserver was distributed as a mezzanine? | |
Pekr: 27-Dec-2005 | yes .... I thought so, but then I thought maybe there will be some way of how to do it :-) | |
Pekr: 27-Dec-2005 | but that would not solve my case, if RT would do system/locale immutable, then I would not be able to change it. I though about protection by some kind of key, e.g., but dunno if it might work. at first change the key would be provided, for unprotect, the key would be needed ... | |
Pekr: 27-Dec-2005 | Ladislav - one more - can you imagine subinterpreter? e.g. you have kind of rebol interpreter master server in your school, then you have students, global context gets cloned for them and all they do they can do like in normal rebol, just that their scripts are executed in subcontext :-) hmm, maybe it would be easier to launch new interpreter for them anyway ... :-) | |
Ladislav: 27-Dec-2005 | :-) On the other hand, this is a question of philosophy. RT did not forbid you to change the data, because they felt you may have a good reason to do so. Your "philosophy" is opposite - you think, that your users may not have a good reason to change the data. | |
Pekr: 27-Dec-2005 | I just came to the request by simply thinking about localisation and how it can be missued. E.g. "do you want your file to be deleted?" could be replaced by "Do you want to keep your file?" :-) | |
JaimeVargas: 30-Dec-2005 | Pekr. I don't understand what you want here? Do you want me to post the printf code to the ML? | |
Henrik: 3-Jan-2006 | graham, the fact that it isn't there, kinda ruins my idea for implementing percent based widths in LIST-VIEW so that it's easy to discern between integers and percentages such as [50% 30%]. That's not so easy now, unless I do it the hokey way and use issue! or some other type to describe percent. | |
JaimeVargas: 4-Jan-2006 | CounterClass: context [ c: 0 bump: does [c: c + 1] read: does [c] bump-by: func [inc][c: c + inc] ] make-instance: func [ class /local class-vars instance-data class-methods v ][ class-vars: copy [*-private-*] class-methods: copy [] instance-data: copy [] foreach w next first class [ either function! = type? v: get in class :w [ append class-methods compose/deep [ (to set-word! :w) func [(first :v)] [ bind second get in class (to lit-word! :w) '*-private-* do reduce [get in class (to lit-word! :w) (first :v)] ] ] ][ append class-vars :w append instance-data reduce [to set-word! :w :v] ] ] use class-vars compose/deep [ (instance-data) context [(class-methods)] ] ] ctr1: make-instance CounterClass crt2: make-instance CounterClass ctr1/bump ctr1/bump ctr1/read ctr2/bump ctr2/read | |
JaimeVargas: 6-Jan-2006 | make-instance: func [ class [object!] /local class-vars instance-data class-methods v ][ class-vars: copy [*-private-*] class-methods: copy [] instance-data: copy [] foreach w next first class [ either function! = type? v: get in class :w [ append class-methods compose/deep [ (to set-word! :w) func [(first :v)] [ bind second get in (:class) (to lit-word! :w) '*-private-* do reduce [get in (:class) (to lit-word! :w) (first :v)] ] ] ][ append class-vars :w append instance-data reduce [to set-word! :w :v] ] ] use class-vars compose/deep [ (instance-data) context [(class-methods)] ] ] | |
MichaelB: 6-Jan-2006 | Just saw - a little bit easier would have been to do it with *-private-*. | |
Volker: 6-Jan-2006 | Do you know how to do cgi-style-calls in c? where c and rebol communicate thru kind of bidirectional pipeline? | |
JaimeVargas: 6-Jan-2006 | make-instance: closure [ class [object!] /local class-vars instance-data class-methods v ][ class-vars: copy [*-private-*] class-methods: copy [] instance-data: copy [] foreach w next first class [ either function! = type? v: get in class :w [ append class-methods compose/deep [ (to set-word! :w) func [(first :v)] [ bind second get in class (to lit-word! :w) '*-private-* do reduce [get in class (to lit-word! :w) (first :v)] ] ] ][ append class-vars :w append instance-data reduce [to set-word! :w :v] ] ] use class-vars compose/deep [ (instance-data) context [(class-methods)] ] ] | |
Volker: 6-Jan-2006 | do reduce [get in class (to lit-word! :w) (first :v)] -> do get in class (to lit-word! :w) (first :v) ; should work too | |
BrianH: 7-Jan-2006 | The context is fine. When you do c: b you are setting c to the value of b (or rather a copy, since 0 is an immediate value). When you change the value of b the copy of the old value remains the same in c. | |
Pekr: 13-Jan-2006 | how to easily do base conversion? e.g. working with bitmasks, I want to be easily able to obtain e.g. 255, #FF, "11111111" | |
Luca: 22-Jan-2006 | I need to "filter" the content of an object. Any better idea on how to do it other the this one: obj: make object! [ bb: 1 cc: 4 dd: 7 ] block: [bb dd] filter: func [obj block /local newobj][ newobj: make object! [] foreach [s v] third obj [ if find block to-word s [ newobj: make newobj reduce [ s v ] ] ] newobj ] probe filter obj block Result: make object! [ bb: 1 dd: 7 ] | |
Pekr: 26-Jan-2006 | I tried Carl's site monitor - Gismo, but it converts sites to tcp ports, instead of staying with http ... how can I easily add proxy support to manually constructed tcp port? I do remember some tricks with subport where actually port is, but can't make it work easily ... | |
Anton: 26-Jan-2006 | Terry, do you think it's really a good idea to change that now ? | |
Terry: 28-Jan-2006 | Nothing in there that I can send to you, that will allow you to find me.. so how do i determine (via Rebol) the IP address assigned to the router? | |
Terry: 28-Jan-2006 | Not sure that this can even be determined with Rebol.. Probably need to do a workaround.. send a http request to a remote script, peel the IP from that, send it back? | |
Henrik: 28-Jan-2006 | yeah, well I don't think they are ultra fast (and there is only one ethernet port on mine), but I think you can do some bizarre stuff with them, such as cron scheduled downloads to an ethernet harddisk. I've always thought that REBOL could really do a lot for hardware at that level. | |
Graham: 29-Jan-2006 | I lot of people don't have the technical savy to do these things .. so you create a wireless appliance for specific purposes. | |
Henrik: 29-Jan-2006 | hmm... I can't seem to figure this out: >> w: copy reduce [make object! [test: 27]] >> set [y] w == [make object! [ test: 27 ]] >> probe y make object! [ test: 27 ] This part is ok. Now I want to add new keys to the object. How do I do that while keeping the reference to the W block? I can set existing keys: >> set in y 'test 35 >> w == [make object! [ test: 35 ]] >> set in y 'test2 127 ** Script Error: set expected word argument of type: any-word block object ** Near: set in y 'test2 127 Can't do that. >> set y make y [test2: 127] Then I lose the reference to the W block. Y is a point I use in a large object which I traverse. It contains smaller objects and these smaller objects must sometimes be updated. The position is remembered with Y. I want to MAKE objects there without losing the reference to W. | |
Graham: 29-Jan-2006 | Well, that's what I do when I need to extend an object .. though it's not in place. | |
Henrik: 29-Jan-2006 | the point is, I need the position to copy it into. The position is automatically and elegantly referenced by Y and can be a lengthy calculation, if I need to find it again, but I may need to do that or make some other position marker which contains the block that holds the object I need to change. | |
MichaelB: 3-Feb-2006 | what do you mean ? (you don't need to copy yourself - thus saving a word?) | |
Henrik: 5-Feb-2006 | how do you test for a function that returns nothing? I want to DO a script, and check if there was an error, but the script might sometimes not return anything | |
Pekr: 9-Feb-2006 | Bobik used str: "[1 false]" val: load str ... so basically, he "executed" (evaluated) string, he got block, but he forgot to do the same for block content - so here reduce comes in the play ... | |
Sunanda: 9-Feb-2006 | It can be annoying because reduce does not have a /deep refinement -- so if you load nested blocks, you may need to do a lot of reduces to make it work: xx: reduce load " [ false [ true]]" == [false [true]] type? xx/1 == logic! type? xx/2/1 == word! | |
Pekr: 17-Feb-2006 | he is kind of half a year Rebol novice and it is good to see those opinions ... those shared values etc. are REALLY a pain for beginner and such small styles bugs make life of mid-level developer (who is not fluent with View internals) View XY percent less sutiable to do real work ... | |
JaimeVargas: 21-Feb-2006 | Yes. I do to use as many bits as possible. | |
Anton: 23-Feb-2006 | It would be good to be able to answer a question like this: "Do the functions: [print parse encloak] exist and behave the same on Rebol/Core 2.5 and 2.6, and Rebol/View 1.2.1 and 1.3.1?" | |
Geomol: 23-Feb-2006 | Pekr, no SQL interface yet. I started to do a SQL interface doing my education, but didn't finish it. SQL is crap. ;) | |
Group: !REBOL3-OLD1 ... [web-public] | ||
yeksoon: 12-Dec-2006 | I don't speak French...and do not face much problems moving around Paris speaking English. though... for Reichart's case, you will need to speak MUCH slower. | |
Gregg: 14-Dec-2006 | :-) Not only do very few of us speak a second language, but many of us have trouble with English. I always smile when I chat with people from around the world who apologize for their poor English when, in reality, it's often more correct than what American's write. It doesn't have the natural flow of a native speaker, but more advanced words are used, and used correctly. Knowing, now, how hard it was just to learn a few phrases in other languages for my dialect session, I have even more respect for all of you who give *entire* presentations in a non-native language. | |
Gregg: 14-Dec-2006 | I'll have to add Danish if I ever do it again. :-) I couldn't have done it without a lot of help from the native speakers, particularly Richard. I wasn't even *close* on my Czech, working from translated text. At least he got a good laugh out of it. :-) Fortunately, nobody was there who could criticize my Indonesian. | |
Henrik: 20-Dec-2006 | I think the normal procedure is to manipulate your block like you normally would and then convert it to hash! when you want to do lookups | |
JaimeVargas: 20-Dec-2006 | APPLY just means run this function with the block content as args. So: APPLY :+ [1 2 3 4] is equivalent to DO [+ 1 2 3 4] ;; using scheme semantics | |
Pekr: 25-Jan-2007 | to reduce or not to reduce, that is the question. I have no clear answer myself, although I might prefer Ladislav's version too, if it allows more functionality. But generally speaking (not telling this is the case), if we will create some scenario, where 90% of usage will push users to add 'reduce word, because user wants it in those 90% of case, then reduced state should be reduced, or users will a) do mistakes not reducing themselve b) regard it being a bug c) use reduce automatically without thinking why is it needed :-) | |
BrianH: 25-Jan-2007 | Keep in mind that Carl has said that APPLY would be used to implement DO in REBOL 3 code. | |
Pekr: 25-Jan-2007 | btw - if we get Rebol ported natively to target devices, what do we get specifically by linking (or porting) it to .NET? btw - is it difficult to establish such an interoperability? | |
Ladislav: 25-Jan-2007 | Your idea about APPLY sounds nice in theory, but in practice it would add a block allocation to almost every call of what should be a low-level, efficient native function. - I am not sure I understand what you have in mind - do you mean you didn't like APPLY :f GET [...] ? | |
Volker: 25-Jan-2007 | Good reason. And in that case auto-get disables to send words. apply would 'get them. Brian said: Keep in mind that Carl has said that APPLY would be used to implement DO in REBOL 3 code. In that case gettin would make sense. Or when using apply from rebcode. If Carl reuses the code there. | |
Volker: 25-Jan-2007 | yes. some way to do without get is a must-have. and for get one can write the code directly instead of going thu apply. I now prefer your version. | |
Gabriele: 25-Jan-2007 | i would be happy to just do a reduce or get in that case. | |
Geomol: 10-Feb-2007 | In the comments about ++/--, I suggested a new way of defining arguments to functions: >> mult2: func [value:] [value * 2] >> mult2 4 == 8 >> a: 3 >> mult2 a == 6 >> a == 6 With this addition to the language, INC could be written: inc: func [value:] [value + 1] Of course it would be better to have INC native, but with my suggestion, it will be possible to make our own functions, that works like INC and DEC. What do you think? | |
Geomol: 10-Feb-2007 | We can also look at it this way: Anything is possible in dialects. It's possible to make a dialect parsing a block, where I can use root as an operator. If it's possible in a dialect, why shouldn't it be possible directly in the language? Of course it's then easier to make code hard to read and understand, but that's possible today with dialects. Will we as developers have the freedom to do almost anything, and then it's up to us to develop code easy to read and understand, or will we like restrictions? If the freedom is used the right way, it's also easier to develop code, that IS easier to read and understand. My point of view is, that when the language has operators, it should be possible to make our own operators too. If ++/-- are introduced, it should be possible in an easy way to make our own functions working the same way. | |
Geomol: 12-Feb-2007 | Okay, what then if INC/DEC are introduced in the language in a way, so they work more like we're used to with e.g. NEGATE, but at the same time allow, that variables can be changed? We have to use call-by-word (the REBOL way of call-by-reference) to have the variables changed. Like this: >> a: 4 >> inc a == 5 >> a == 4 >> inc 'a == 5 >> a == 5 So INC has to check, if it's called with a word, and then get it's value before adding one, and in the end do a set-word. We could have the same with NEGATE and other functions (actions) of the same kind: >> negate a == -5 >> a == 5 >> negate 'a == -5 >> a == -5 Does that make sense? And is it REBOLish? | |
Volker: 12-Feb-2007 | A question about operators: wouldit make sense toevaluate them from right to left? so that a = 5 * 3 would be (a = (5* 3)) i think that is more native. and more in line with functions, which evaluatethe right part first. Do i overlook something? Except that it breaks all current code. | |
BrianH: 12-Feb-2007 | ; INC/DEC with lit-word arguments: increment: func [ [catch] 'x "Value to increase" y [integer!] "Amount to increase by" /local t ] [ throw-on-error [ if path? :x [ x: in do copy/part :x back tail :x last :x ] t: either any [word? :x paren? :x] [do :x] [:x] case [ series? :t (t: skip :t y) number? :t (t: t + y) ] either word? :x [set/any x :t] [:t] ] ] inc: func [[catch] 'x] [increment :x 1] dec: func [[catch] 'x] [increment :x -1] decrement: func [ [catch] 'x "Value to decrease" y [integer!] "Amount to decrease by" ] [increment :x negate y] | |
BrianH: 12-Feb-2007 | ; INC/DEC with regular arguments, must use lit-word! or lit-path! directly to get side effects: increment: func [ [catch] x "Value to increase" y [integer!] "Amount to increase by" /local t ] [ throw-on-error [ if path? :x [ x: in do copy/part :x back tail :x last :x ] t: either word? :x [do :x] [:x] case [ series? :t (t: skip :t y) number? :t (t: t + y) ] either word? :x [set/any x :t] [:t] ] ] inc: func [[catch] x] [increment :x 1] dec: func [[catch] x] [increment :x -1] decrement: func [ [catch] x "Value to decrease" y [integer!] "Amount to decrease by" ] [increment :x negate y] | |
Maxim: 13-Feb-2007 | geomol and others... INC with lit-words is seriously flawed in actual use ... a: inc a ?? what's the point of it... lit-words are not word values they are labels, they are not usable unless the word exists "somewhere else" its not THE a you are evaluating but AN a somewhere... which is why this is as alien to rebol as anywhere else. if all series can change values "in-place" like append... why not allow this for scalars (and others) too? its already an integral part of REBOL ... I don't see the "confusion" in INC a changing THE a... its exactly like append a, but for another type... hell, I've wanted in-place editing for many things which aren't series and it would speed up code, just like not having to copy series all the time like python. ADD-TO a 10 when you do INC 'a you HAVE to declare 'A somewhere else... which is not in rebol's philosphy. this is completely different thinking to rebol... its much closer to C style... where you expect a to exist somewhere... the lit word syntax, just cause a big confusion within the normal chain of rebol coding IMHO its not simple, and certainly not obvious... most newbies don't even get what a lit-word is. just like SET which is used only (usually) to implement other tricks in the language... we shouldn't be using SET in normal code. INC is not a trick word... its something I'd be using in many scripts, unlike SET which I seldom need to. just giving my view on this topic. ;-) | |
Maxim: 13-Feb-2007 | I know many of you are very technical and scientific, but this is a kind of detail, which is IMHO not in REBOL's mindset and don't mind a little bit of extra "precision" or "correctness". but REBOL is not about being correct and strict... its about being simple and productive... so even if you are probably correct in your analysis... I do think its not a simple detail to understand for the vast majority of REBOLers. The interpreter should addapt to use, not the opposite. INC a means increment a, who cares what this means within the interpreter, words already are pointers internally, so its not such a big deal to implement anyways AFAICT. in the end, we will be typing an extra ' all the time and really will be adding complexity elsewhere in the code, cause we have to "remember what a means, somewhere" or end up doing a: INC a which is sort of pointless. Also, its an op, not a function. just like + - = ... its not supposed to follow a function's tought pattern. | |
BrianH: 13-Feb-2007 | The relevant portion is: if path? :x [ x: in do copy/part :x back tail :x last :x ] This retrieves the word to be updated and puts it into the x local variable, just as if you had called the function like this: increment in some/object/some 'value 5 | |
BrianH: 13-Feb-2007 | While we're at it Ladislav, I'd like your opinion about an idea I posted on the blog comments. I was thinking about the possibility of adding trampoline actions to the word! and path! datatypes. When an action is called, execution is forwarded to a native function associated with the data type of the first argument, the action handler. In other languages this is called dynamic dispatch. My idea is to add action handlers to the word! and path! datatypes that would lookup any referenced value and forward execution to that value, and then possibly change the reference of the word to the result before returning. This proposal would, in effect, add seamless support for side effects to REBOL evaluation. For instance, if there was a trampoline for the ADD action, increment would be basically this: add 'a 5 The disadvantage is that side effects won't be as clearly limited to set-word expressions and SET functions, so you would have to trace the dataflow to know whether the a in: add a 5 refers to a number, or to a word that refers to a number. There are other places in REBOL that need similar dataflow analysis to understand your code though - the consequence of dynamic typing. What do you think? | |
BrianH: 13-Feb-2007 | The speed of datatypes comes from the fixed action list. It allows the dispatch to be a simple retrieval from a fixed offset into a function table, no lookup required. It is not the same thing as general class-based methods, which in a language with dynamically typed variables would need to do a lookup to figure out where to find the method to call, same as with instance-based methods. | |
Maxim: 3-Apr-2007 | is it just me or is it obvious R3 is about giving us what we always asked for and need? so far, all I read is user requests coming to life. If people think 100% open source is the universal panacea... I think its time people looked at how REBOL is evolving. I think R3 might be the middle ground which allows much of the "open" discussion to be irrelevant. user types, open linking and compilation, lexical allowance for unrecognised tokens, somehow, this seems like we will be able to mold (sorry for the pun) REBOL into what we need, finally, rather than molding what we do to what REBOL (the interpreter) wants :-) |
4601 / 11578 | 1 | 2 | 3 | 4 | 5 | ... | 45 | 46 | [47] | 48 | 49 | ... | 112 | 113 | 114 | 115 | 116 |