help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: string serialization of builtin datatypes


From: Andreas Weber
Subject: Re: string serialization of builtin datatypes
Date: Thu, 07 May 2015 20:30:50 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.4.0

Am 06.05.2015 um 20:20 schrieb Oliver Heimlich:
> On 06.05.2015 19:47, Andreas Weber wrote:
>> I once wrote a serialize function
>> (https://github.com/octave-de/serialize) to get a human readable string
>> representation of built in datatypes.
>> ... 
> Some remarks for improvement of the function:
>  - If you want to ensure exact restoration of the original value, you
> certainly want to increase the precision during the call to mat2str for
> binary64 numbers.

Thanks, done.

>  - Also you should vectorize function evaluation with the usage of
> cellfun/structfun instead of for-loops.

If I create a new project my typical approach is:
a) write the tests and function skeletons
b) implement them without much speed tuning (readability is better)
c) If all test passes let it settle, then benchmark, profile and
optimize for speed. (active)

>> btw: Do we have a function which checks a string for malicious code
>> before evaluating? For example wget, system, unlink and so on.
> 
> I don't think it exists. This is the big disadvantage of serializing
> data into code that has to be eval'ed. Did you try JSON or YAML as a
> readable kind of serialization?

No, never tried. Philip wrote there is a JSON implementation in io package.

-- Andy



reply via email to

[Prev in Thread] Current Thread [Next in Thread]