1. CyrekSoft announcement and "DISCARD"

Hello,

I love cryptograms

>"Ykk rnyllaqur rgiokc cea nyemdok ymc giququezka caysgr." - B.Q.Vgesa

Ahem, that would be:
"All spammers should die painful and horrible deaths - C.R.White"

The name at the end tipped me off and game me 7 letters to go on.
And then I noticed a pattern... so I got:
"All spammerys should die painful and horyryble deaths - C.R.White"
..and I was like "huh?" and then I figured out your little "qu" trick
and I had it made.

these are fun.. but back to Euphoria...

Ralf mentioned adding a built in global variable: "discard" to assign
values that will not be used.  While I see its usefulness I don't think
it is really neccesary but here are my ideas on the subject.

Instead of a variable why not use a built in PROCEDURE called "discard
()".  Passing the return value of a function to discard would do the
same thing as Ralf suggested.  Also passing a variable to discard would
destroy that variable (make it undeclared and free its memory). This
would be more useful to me than just discarding a return value and if it
could do both it could be VERY useful.

--an example of Ralf's suggestion:
include graphics.e
object x

function stuff()
  stuff....
  return stuff
end function

discard = graphics_mode (18) -- the graphics mode is changed and
                             -- the value is discarded
pixel (......)
polygon (.......)
x = stuff ()            -- stuff returns to a variable
discard = stuff ()      -- stuff used for side effect only
discard = graphics_mode (-1) --graphics_mode changed back

--- this would be usefull but how about this:


include graphics.e
object x

function stuff()
  stuff....
  return stuff
end function

discard (graphics_mode (18)) -- graphics_mode is changed and
                            -- value discarded
pixel (......)
polygon (.......)
discard (sfuff ())     -- stuff used for side effect
x = stuff ()           -- stuff returns to a variable
discard (x)         -- x is no longer declared ##### NOTICE #####
discard (graphics_mode (-1)) --graphics_mode changed back
--end

To me the act of discarding something would best be handled by a routine
than a variable. The only thing that I have against Ralf's suggestion is
that it doesn't seem consistent with Euphoria ... not that mine is
either but possibly more so?

Ralf's idea was centered on speed while mine was on memory management. I
think that freeing up memory (associated with unnecesary variables)
would help speed as well.

just my 3.141592 cents worth,
Lewis Townsend

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

new topic     » topic index » view message » categorize

2. Re: CyrekSoft announcement and "DISCARD"

>Ralf's idea was centered on speed while mine was on memory management. I
>think that freeing up memory (associated with unnecesary variables)
>would help speed as well.


I was under the impression, that after the last use of a variable the memory
was freed. (well,. it never ever gets friend until ex.exe ends, however, it
does free it internally, in other words, make it available for futher use by
Euphoria itself only)

However, Im not assuming, multiple assignments before a variable is used in
an expression, are not discarded. I also did not assume, an assignment to a
value, after which it is never used, that ex.exe would skip it. A way around
this would for example be, having ex.exe so smart to free variables just
after they are used in an expression for the last time. And assignments
after that, and multiple assignments in between, can be skipped, off course
with the logical side-effects which *do* need to be called.

And as to the suggestion of using procedures or using it in -if statement,
well...
Would we need to make two versions of every function, one discarding the
returned value.. (procedure) and what that does completely do the whole
calculation and return the result ?
And using an -if- statement is the same as assigning/using the value. Im
talking about those cases where 1) the actual calculation takes some time 2)
we really dont give a *censored* about the result of the calculation.

Ralf

new topic     » goto parent     » topic index » view message » categorize

3. Re: CyrekSoft announcement and "DISCARD"

Ralf Nieuwenhuijsen wrote:
>I was under the impression, that after the last use of
>a variable the memory was freed.
>(well,. it never ever gets freed until ex.exe ends,
>however, it does free it internally, in other words,
>make it available for futher use by Euphoria itself only)
urmmm... that would be bad, if i understand you correctly.
talking psuedocode here, lemme ask a question about the
following:
   sequence mary
        mary = repeat("mary was a little lamb",100000)
        system("mem.bat")
        mary = {}
        system("mem.bat")
where mem.bat simply told you how much memory was available
on your system, and paused for keypress.

now, you are saying that if the first execution of mem.bat
(which is after the huge sequence mary was allocated)
told you that you had 25meg of 32meg free (example!),
then the second execution of mem.bat
(which is after mary is "freed")
will also tell you that you have 25meg of 32meg free?

i hope not. that *completely* violates the definition of
dynamic memory allocation. i could understand if a certain
core amount was reserved for euphoria and a modicum of
data to be held within for speed and efficiency reasons...
like a couple hundred K or so for some ints and atoms and
small sequences was always held... but this is not that case.
this is a case that should defnly 100% be returned to the
*system*, not just EU but the *system*.

or is my interpretation of what you said ralf not correct?

--Hawke'

new topic     » goto parent     » topic index » view message » categorize

4. Re: CyrekSoft announcement and "DISCARD"

>or is my interpretation of what you said ralf not correct?


No, that is precizely how it works.
If you read the docs, it will say, the memory does stay allocated to
Euphoria for further use.

I dont exactly know what the pros and cons are here..

Ralf

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu