[Top][All Lists]

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

Re: pkg.m status and question

From: Mike Miller
Subject: Re: pkg.m status and question
Date: Mon, 6 Jan 2020 09:33:49 -0800

On Mon, Jan 06, 2020 at 04:26:21 -0600, PhilipNienhuis wrote:
> My motive for asking is that this setup of package info makes for needlessly
> inefficient and complicated code. For each tiny action the relevant structs
> have to be unwrapped first. IMO dealing with a struct array rather than cell
> array of structs would make the code much more transparent and much more
> efficient as well.

I agree with this motivation, having seen this before too. I can't speak
to why it was originally done as a cell array of scalar structs.

I do have a speculation. The current design reads each pkg DESCRIPTION
file into a scalar struct, which is then added to a cell array of all
pkgs. A problem arises if you have pkg A which has a "Url" field in its
DESCRIPTION, and pkg B which has a "SystemRequirements" field in its
DESCRIPTION. How do you easily combine two structs with unlike fields
into a single struct array with a superset of all fields?

By way of example,

    a.Name = "first";
    a.Description = "A package";
    a.Url = "https://www.example.org/";;
    b.Name = "second";
    b.Description = "Another package";
    b.SystemRequirements = "fftw3";
    all = [a, b];

doesn't work. But the current cell array implementation does.


Attachment: signature.asc
Description: PGP signature

reply via email to

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