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

World: r3wp

[Core] Discuss core issues

Rebolek
20-Feb-2007
[7263]
Pekr it's official preview and not release
Pekr
20-Feb-2007
[7264]
how comes? Official alpha was supposed to be out 3/4 year ago :-)
Rebolek
20-Feb-2007
[7265]
maybe R3 is little bit delayed because 3D Realms addopted it as a 
main programming language for Duke Nukem Forever? ;P
Maxim
20-Feb-2007
[7266]
I think R3 is not really delayed... I think the plan has simply changed, 
and this time Carl is finally working at delivering what he promised 
at devcon 2004.  He might have realised that its a little bit more 
work to make something so open... you can't hide the ugly things, 
so I'm pretty sure he is doing a lot of cleaning up...  and we have 
been hearing about the fact that this time, view isnt' being left 
behind...
Pekr
20-Feb-2007
[7267x2]
Rebolek :-)))
Maxim - hopefully you are right!
Rebolek
20-Feb-2007
[7269]
I'm OK with R3 release date, but just couldn't resist to make that 
dukenukem joke :)
Pekr
20-Feb-2007
[7270]
rebpro does not contain core stuff? so no decode-cgi for e.g.?
Maxim
20-Feb-2007
[7271x2]
you mean rebol/view pro?
or some sdk build?
Pekr
20-Feb-2007
[7273x3]
no, rebpro I placed on server .... as I needed library access, but 
this time it does not contain decode-cgi, uh, I will have to generate 
my own rebol.exe with features I want?
I vote once again for pad function!
I just needed very simple function, which will return me 20070220 
... so I want to write something like:

join now/year [padl now/month "0" 2 padl now/day "0" 2]

Instead of writing some stupid 'either lenth? code ...
Henrik
20-Feb-2007
[7276]
>> 0.0002
== 2E-4

It may be old, but how do you avoid this conversion_
Pekr
20-Feb-2007
[7277x2]
we have other trivial mezzanines, why not something like 'pad? Who 
writes the simplest code for me ;-)
yes Henrik, that is just another "stupidity"
Rebolek
20-Feb-2007
[7279]
put it in challenge :)
Henrik
20-Feb-2007
[7280]
pekr, I vote for pad too, only because I've written that function, 
oh, about 50 times now.
Pekr
20-Feb-2007
[7281x2]
I had function somewhere, parsing E-+value, and generating string.
maybe it is how Jaime wrote - we need print/form dialect ....
Henrik
20-Feb-2007
[7283]
Well maybe we do, but is that the REBOL way to do it? pad is very 
simple
Pekr
20-Feb-2007
[7284]
simple, often needed, should be added - is that simple as that? :-)
Henrik
20-Feb-2007
[7285]
simple might grow complex enough if you study it closer. I was completely 
surprised at the INC/DEC discussion. :-)
Pekr
20-Feb-2007
[7286]
yes, e.g. padding in the middle of existing series - pad-left, pad-right 
:-)
Henrik
20-Feb-2007
[7287]
one can say, what do you need to pad? it's usually only numbers, 
right? that would narrow down datatypes required to be handled.
Maxim
20-Feb-2007
[7288x3]
pad can also be used to left, center, or right justify strings ... 
my fill (pad) functions allows all variations on string! & number... 
a zfill is just a preset using the "0" char as the pad.  it even 
has a truncate refinement when you need the output to be *exactly* 
the specified length, even if it would be larger than what you ask.
the scientific notation is a side-effect of window's use of IEEE 
floating point libs.  for some reason, on windows, the output is 
automatically converted this way... I have seen this in other apps 
on windows too.  converting to/from a nice decimal would probably 
take too much time.
and henrik and anton would be asking to not convert it  ;-) 


 I always thought to-string should cleanup the decimal! datatype...


what do you think ladislav?  its not load or mold, its specifically 
asking for a string version of a decimal... and in any case the normal 
notation of  0.000004  is still a valid decimal, so I see little 
problems...
Anton
20-Feb-2007
[7291]
Seems a good suggestion - and it appears this formatting issue is 
not in the RAMBO database yet.
Oldes
21-Feb-2007
[7292]
I never know... is it enough to unset block using:
some-block: none
or should I first clear it as well >>[ clear some-block ]
Maxim
21-Feb-2007
[7293]
if you clear it first and there are other references to it, you will 
have better cleanup, but then, you could as well be trashing your 
tool!  so... clear carefully.
Anton
21-Feb-2007
[7294]
yes, it totally depends on your situation. What is the context ?
Oldes
22-Feb-2007
[7295x2]
I have just block where I append string values. I use it in recursion, 
so when go down in recursion, I copy the block into stack clear it 
and reuse the variable. When I'm going back I restore previous block 
values if any or set it to none, when it's the last one (end of recursion). 
Don't know if my explanation is clear, but will still use the 'clear' 
on my block:)
And there should not be any references into string values in my block 
(I hope:)
Anton
22-Feb-2007
[7297]
Is your some-block local to your recursion function ?
Oldes
23-Feb-2007
[7298]
No. If it would be local, I would not need to clear it and store 
myself, wouldn't I?
Henrik
23-Feb-2007
[7299x2]
Does anyone miss a function that tells with true/false if a variable 
can be converted to a different datatype? I find myself doing lots 
of test on input from text fields with attempt blocks.

something like:

to-integer? 'test
== false
>> a: "6"
>> to-integer a
== 6
>> a: "u"
>> to-integer a ; script fails here so we need to handle it
** Script Error: Invalid argument: u
** Where: to-integer
** Near: to integer! :value

>> attempt [to-integer a]  ; useful, but less clear what fails. Is 
'a not a value or can it not be converted to integer?
== none

>> to-integer? a ; 'a definitely exists, but can't be converted to 
integer.
== false
Oldes
23-Feb-2007
[7301x2]
>> to-integer?: func[a][ not error? try [to-integer a]]
>> to-integer? "1"
== true
>> to-integer? "a"
== false
to-integer?: func[a][ not error? try [to integer! a]]
Henrik
23-Feb-2007
[7303]
yes, something like that, thanks
Oldes
23-Feb-2007
[7304x2]
And I must say it again... I use ATTEMPT only in cases where I do 
not expect error. Many people use it just a shortcut for error? try 
which I don't lik. As I understand attempt as higher function for 
reporting not wanted errors (for example on server). If you use it 
in cases, where like attempt [to-integer "a"] it's not good as it 
would report many errors (in some bigger context)
And Henrik, I don't think Carl will add it into Rebol as it's too 
easy to implement yourself.
Henrik
23-Feb-2007
[7306]
Oldes, probably not, though this is just one case. A more complex 
datatype like date! requires more complex checking schemes.
Oldes
23-Feb-2007
[7307]
And I would not use it, as I usually use something like this:
if error? try [a: to integer! a][a: 0]
Henrik
23-Feb-2007
[7308x2]
And date! does not behave like integer!:

>> a: 1
== 1
>> b: "2"
== "2"
>> c: "u"
== "u"
>> to-date reduce [a b c]
** Script Error: Invalid argument: 2
** Where: to-date
** Near: to date! :value
This is probably a dumb case since endusers don't determine the types 
themselves.
Oldes
23-Feb-2007
[7310]
and if I would use it, I would probably use it like:
to-date?: func[a][ not error? try [a: to date! a]]
CharlesS
23-Feb-2007
[7311]
can the to function translate to user defined structures / objects 
? if  so how, is there a special method name in the object you want 
to convert to ?
Sunanda
23-Feb-2007
[7312]
If I understand your question, Charles, you may be looking for construct/with......It's 
a way of using an existing object as a template for a new one, eg:
 my-obj1: make object! [a: 99 b: 2 c: "string"]
my-obj2: construct/with  [b: 9999] my-obj