World: r3wp
[Core] Discuss core issues
older newer | first last |
Gregg 13-Sep-2005 [1937] | I agree that hidden things like this can be dangerous, but how many of us have actually had a problem with it (this issue) in our applications? |
Ladislav 13-Sep-2005 [1938] | I did |
Gregg 13-Sep-2005 [1939] | My view is that Carl made this a conscious choice, knowing that advanced users could do their own copy/deep when they need to, and it won't come up most of the time anyway. |
JaimeVargas 13-Sep-2005 [1940] | We have encounter a lot of Gotchas in our development, and part of the reason we are slowed down many times. |
Gregg 13-Sep-2005 [1941] | Yes, but you're a special case Ladislav. :-) |
JaimeVargas 13-Sep-2005 [1942] | We are coding cutting edge stuff. Callbacks, Sophisticated Async Networking and others. |
Ladislav 13-Sep-2005 [1943] | well, but my suggestion regarding CONTEXT isn't very aggressive, is it? |
Gregg 13-Sep-2005 [1944] | Right, and I agree that this kind of thing should absolutely be documented, but I also think I understand why it works this way. |
JaimeVargas 13-Sep-2005 [1945] | So if new users start to code complex applications they hit the problems that are not well documented and not easy to catch. |
Ladislav 13-Sep-2005 [1946] | context: func [ "Defines a unique (underived) object." blk [block!] "Object variables and values." ][ make object! copy/deep blk ] |
Gregg 13-Sep-2005 [1947] | And, yes, I think it might be OK for CONTEXT to do a copy on the spec; I wouldn't even add the no-copy option,. |
Ladislav 13-Sep-2005 [1948x2] | :-) |
a similar issue exists for USE (use copy/deep spec) , and FUNC (solved by my CLOSURE) | |
Gregg 13-Sep-2005 [1950] | 1) Documentation is important. 2) Once you know about this behavior, which applies to most areas of REBOL, not just objects, you can easily solve it. |
Ladislav 13-Sep-2005 [1951x2] | ...and MAKE PROTOTYPE-OBJECT SPEC |
the CLOSURE case is not that easy | |
Gregg 13-Sep-2005 [1953x2] | But closures are a very advanced concept; normal people will never even hear the term. |
The biggest risk I see for normal people, is when you're doing things like deserializing objects and such. | |
Ladislav 13-Sep-2005 [1955] | wrong - everyone is going to need closures once writing async code |
JaimeVargas 13-Sep-2005 [1956] | Closures are usefull for concurrent programming which is needed in async schemes. |
Gregg 13-Sep-2005 [1957] | But, again, that is an advanced concept. If only 10 people in the world understand it, that's OK, as long as they hide those details so it just works, magically, for the rest of us. :-) |
Ladislav 13-Sep-2005 [1958] | but once the core becomes async, everyone will have to adjust to it |
Gregg 13-Sep-2005 [1959] | Why? I don't have to know anything about how REBOL's GC works, do I? If *everyone* has to understand and adjust to async, and if even 10% of people need to know how closures work, that would be a tragedy. |
Ladislav 13-Sep-2005 [1960] | you do not *need* to know how closures work, the only thing you need to know is, that when you use a closure instead of a function, some bugs vanish |
JaimeVargas 13-Sep-2005 [1961] | If we are pushing rebol to be capable of handling more and more problem spaces, then we need more powerful constructs and excellent docs. |
Gregg 13-Sep-2005 [1962] | more powerful constructs , like what? (kind of playing Devil's Advocate here) |
JaimeVargas 13-Sep-2005 [1963] | closure, associative arrays, construct with deep copy, load on values that don't exist in system object, others. Some of the bugs that have been fixed are due to our need for more power, stable and predictable interpreter. |
Gregg 13-Sep-2005 [1964] | stable and predictable; I'm all for that. Beyond the LOAD issue, we can do all that, right? |
JaimeVargas 13-Sep-2005 [1965] | Yes, we can patch rebol and fixed ourselves, but we should remove some "surprises" like making CONSTRUCT safe. |
Gregg 13-Sep-2005 [1966] | It's really a question of default behaviors, right? (making sure we're talking about the same thing) My concern is that, by making more things "safe" at the native level, we may create more issues than we solve. |
JaimeVargas 13-Sep-2005 [1967x2] | I had another issue with the behaviour of APPEND which is different for block! hash! than from list! and it is a side effect of INSERT and REMOVE APPEND b: make block! [] [v1 v2] head? b ;== true APPEND l: make list! [] [v1 v2] head? l ;== false |
I don't know how many of this type of examples are there, but is quite annoying to debug these side effects. | |
Gabriele 13-Sep-2005 [1969] | that has nothing to do with append - that has to do with list!s. |
Gregg 13-Sep-2005 [1970] | I would say that's a bug in APPEND, because of the way the doc-string is worded. |
Gabriele 13-Sep-2005 [1971x2] | l: append ... would work |
but append l ... does NOT change the word 'l | |
Ladislav 13-Sep-2005 [1973] | actually, it isn't a bug and it is almost impossible to change, but it may need a documentation |
JaimeVargas 13-Sep-2005 [1974] | We need more consistency. I discuss the APPEND issue extensively with Ladislav, and it is about docs and side effects. What I fear is the explosing of exceptions. |
Gabriele 13-Sep-2005 [1975] | could be changed, but only for the "head" case, if the list head was a special node (like Exec's double linked lists) |
JaimeVargas 13-Sep-2005 [1976x2] | I would like also to be able to implement our own types! and be able to overload some words. So that an implementation of associative arrays can work look like [make aa! 10] instead of [aa/make 10] |
Any opposition on proposing the change to CONSTRUCT? | |
Gregg 13-Sep-2005 [1978] | Do you mean CONTEXT? |
JaimeVargas 13-Sep-2005 [1979] | Sorry CONTEXT. |
Gregg 13-Sep-2005 [1980] | You can propose it. I'm happy to let Carl decide. I wonder if it might cause some confusion as it won't be an exact replacement for make object!, which it's just a shortcut for. It could break code and change behavior if substituted. |
Ladislav 13-Sep-2005 [1981] | I am quite curious if it breaks really would break some code |
Graham 13-Sep-2005 [1982] | Jaime, can you list these issues in the gotchas in the wikibook so that they can be documented for all. |
BrianH 13-Sep-2005 [1983] | I would probably stop using CONTEXT with this change. I may not be a newbie, but I don't see how this behavior is different from the way blocks that aren't explicitly copied are shared throughout REBOL. Once you learn this gotcha once (like, the first time you make a function with a local block), you have learned it throughout. There are always workarounds, and the default behavior can be extremely useful if you are expecting it. |
Ladislav 13-Sep-2005 [1984x3] | I am speaking about the following example: |
objects: [] loop 2 [ append objects make object! [a: 1 block: [a]] ] objects/2/a: 2 do objects/1/block ; == 2 ! | |
are you sure you can never be caught? | |
older newer | first last |