r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[!REBOL3-OLD1]

Henrik
28-May-2009
[14479]
oh, 'lm has been updated. Nice.
Pekr
28-May-2009
[14480]
ah, load-plugin .... what a bad name once again. Why load or import 
does not handle it internally? ('import is used in the blog article)
BrianH
28-May-2009
[14481x2]
That sounds like an internal function that hasn't been put in a module 
yet. There is a similar function MAKE-MODULE.
You don't call make-module - MAKE calls it.
Pekr
28-May-2009
[14483]
Good thing is, that Carl asked us to not use plugins yet, which might 
mean, that the code is already in there :-)
BrianH
28-May-2009
[14484]
But I can't say for certain, as that part of the plugin interface 
isn't documented yet.
Pekr
28-May-2009
[14485x2]
I just re-read docs about plugins and devices, and I still wonder 
what is the main difference? Are devices just for I/O? Because devices 
do use commands too. But - devices just don't define new functions, 
whereas plugins might do.
Brian - what needs to be implemented for utypes? Do you think we 
will get them for 3.0?
BrianH
28-May-2009
[14487]
A:

1) They are different concepts, but devices may be implemented in 
plugins.

2) Devices wrap host or hardware things. These things include stuff 
needed for I/O, graphics, etc.
3) Well, plugins for start :)
4) Yes, absolutely.
Pekr
28-May-2009
[14488]
thanks. I just have a little problem understanding 1), but never 
mind. So plugins are superset, the ability to extend environment. 
And as they can contain REBOL code, C code, they can contain even 
Device in itself? Well, it will be better to wait for API docs probably, 
to see some real-life examples ....
BrianH
28-May-2009
[14489]
Basically, the difference between plugins and devices is that pluugins 
are code that wraps code, while devices are objects that wrap hardware.
Pekr
28-May-2009
[14490]
As for 4) - I know you guys find them important (utypes). But what 
will we gain having the ability to do our own datatypes? btw - having 
own datatype will have to fulfill some needs, as for e.g. utype will 
have to be able to react to some functions?
BrianH
28-May-2009
[14491]
Plugins are pretty much modules, but with the possibility of native 
code.
Henrik
28-May-2009
[14492]
do devices wrap hardware directly like a real device driver or does 
it wrap the underlying OS driver?
BrianH
28-May-2009
[14493]
We need utypes for host interoperability, to replace rebcode, and 
more. A utype will need to be able to react to the actions, just 
like a type
Dockimbel
28-May-2009
[14494]
Re 1): Pekr, it's the same difference than driver vs library for 
an OS.
BrianH
28-May-2009
[14495]
Henrik, yes, in theory either. R3 is built like an OS.
Pekr
28-May-2009
[14496]
But - I can imagine having library containing functions to handle 
mouse, but Amiga had device for each, which allowed it to function 
in a more async way ...
BrianH
28-May-2009
[14497]
Right. R3 is built like an OS. And designed by the same guy who designed 
*that* OS. It might follow a similar model.
Henrik
28-May-2009
[14498]
this will probably be most useful on embedded or specialized hardware 
for now
BrianH
28-May-2009
[14499]
The device will have associated functions, but those functions might 
be defined in a plugin. Or not.
Dockimbel
28-May-2009
[14500]
R3 devices wrap OS API (or third-parties API), no direct hardware 
access, that's way too costly to achieve.
BrianH
28-May-2009
[14501]
Too costly on host OSes, you mean. Some host OSes provide APIs that 
structure hardware access, like the Direct* APIs. Devices could use 
those. Or if R3 is just running on a bootloader (as proposed in Wildman), 
the device functions would access hardware directly.
Pekr
28-May-2009
[14502x2]
Brian - ticket #588 does not crash here. It just takes lots of time 
and resources to display 20x9999999 size button :-)
it is related to other bug, which is marked as Tested already. We 
should close this one probably too ...
BrianH
28-May-2009
[14504x2]
OK, I'll mark it as tested for the same alpha.
Done.
Dockimbel
28-May-2009
[14506]
About #564 and blog#207: I'm a little lost, is option 3 already implemented 
in alpha55?
BrianH
28-May-2009
[14507]
No, most of 2 is already implemented.
Dockimbel
28-May-2009
[14508x2]
Ok, after testing and reading again your comment in #564, my example 
in blog's article is wrong, it should have been :
>> if any [get/any 'tst 123] [print "ok"]
ok
My example raises an error (as it should do) : 
>> if any [tst 123] [print "ok"]
** Script error: tst has no value
** Where: any
** Near: any [tst 123] [print "ok"]
BrianH
28-May-2009
[14510]
Yeah, that makes sense. Btw, option 2 has been mostly implemented 
since alpha 38, which came out in January.
Dockimbel
28-May-2009
[14511]
So the silently ignored typo issue still exists, but would be much 
less frequent than I feared.
BrianH
28-May-2009
[14512]
Part of the trick here is that you have to balance the benefits of 
error generation versus the overhead of error handling. We've been 
careful to make a lot of code that used to generate errors in R2 
just work in R3. If there is a good rationale for "just working" 
that is.
Dockimbel
28-May-2009
[14513x2]
Is such move really going toward the PITL where R3 is supposed to 
bring us? It sounds more like going in the PITS way, making throw-away 
code even eaiser to write. Maybe I'm just not understanding well 
what your were saying.
I agree on the benefits of treating unset! as noops in such cases 
: 
ANY [( )] == none
ANY [( ) 1] == 1
It's usefull and is consistent with the way COMPOSE treats ( ).


But I still think that's some way of getting unset! values may lead 
to undetected errors like in :
>> test: func [a] [print a exit]
>> if any [test 123] [print "ok"]
123
== none
>> result: test 1
1
** Script error: result: needs a value


I understand why you were asking for such change, but it's hard to 
know if it won't cause more trouble than gain.
BrianH
28-May-2009
[14515x4]
What I'm saying is that sometimes this kind of thing is not an error. 
The question is whether it is an error more often than not, and if 
the error is critical enough to justify the error handling code that 
comes from generating the error.


Take the ordinals, for example. We decided to redefine out-of-bounds 
for the ordinals as not-an-error. It now means return-none, where 
none is the possibly OK non-data that can be handled with low overhead.
Keep in mind that people already use ALL and ANY for error handling, 
and that these functions are lower-overhead than TRY and ATTEMPT. 
We are trying to reserve generation of errors for those cases where 
the situation is usually or always an error. If it is intended and 
sensible behavior in some cases, we tend to be less stringent.
I'm not saying that unset! values in an ANY or ALL is one of those 
cases where there would be benefits, just that it might be. Benefits 
like being able to use functions like PRINT in ANY or ALL without 
having to do tricks like (print 'hello true). If errors would be 
more common than beneficial code, then generate errors.
ANY and ALL are used as control structures too. If () was defined 
as a noop, I would use it that way on purpose. If not, I wouldn't.
Dockimbel
28-May-2009
[14519]
It's hard to say in advance if it will do more harm than good. Unset! 
values can be generated from various semantic rules, I think it's 
 quite touchy to consider that all these cases are equivalent without 
exhaustively listing all ways to get unset! values and see one by 
one if the proposed change would impact it in a positive or negative 
way.
BrianH
28-May-2009
[14520]
Not a bad idea, at least for the built-in functions. In my experience, 
the main use for PRINT in ANY or ALL is debug statements. Most of 
those go away now that we have ASSERT. We didn't have ASSERT in January.
Dockimbel
28-May-2009
[14521x2]
Btw (digressing a litlle), I've always found inelegant the way unset! 
was used by PRINT or other console-oriented functions to avoid returning 
a value. I'm maybe too purist, but I would have expected PRINT to 
return the passed argument (making PROBE unnecessary). Other solutions 
for making functions (native or user-defined) more console-friendly 
could have been choosed (not having consequences on language's deep 
semantics), like adding a special flag in the spec block! (as 'save 
or 'throw).
choosed = chosen
BrianH
28-May-2009
[14523]
I really don't mind having some functions return no-value. The interesting 
decision to be made on a case-by-case basis whether no-value is an 
optional return or all the time, and whether no-value is generally 
an error when used, or not. #[none!] is the no-value that is generally 
usable as a value, or at least not an error most of the time. #[unset!] 
is th no-value that really is not a value, and most functions treat 
it as an error, but not all.
Dockimbel
28-May-2009
[14524]
I understand unset! values as an exception case where there's no 
value to work with. As such, IMHO, it should be treated as an error 
as much as possible. We should stick to the principle of least surprise. 
 

It wouldn't hurt if R3 unset! values were treated more consistently. 
But this is a deep topic, I remember that Ladislav had some interesting 
propositions about unset! (like, IIRC, removing it from user's eyes 
and keeping it internal only). While browsing about that, I've found 
a few interesting links :
http://www.rebol.net/cgi-bin/r3blog.r?view=0100
http://www.fm.tul.cz/~ladislav/rebol/rep.html#section-18
BrianH
28-May-2009
[14525]
Bug #564 and option 2 were the result of the last time (January) 
we decided on a consistent treatment of unset! values:

- As an error in value contexts, like assignment, function parameters 
that don't explicitly support it.

- As a noop in control contexts, where the value would normally be 
thrown away, like DO blocks. ANY and ALL were added to this group.
Maxim
28-May-2009
[14526x2]
funny, I hadn't realised that do blocks already ignore unset values... 
obviously.
so it makes sense with any and all too.
BrianH
28-May-2009
[14528]
We get a different answer every time we have this discussion :(