Re: Defining a library in one file

Alfredo Beaumont <[email protected]>
Newsgroups gmane.comp.lang.dylan.gwydion.devel
Message-ID <CADVnqbgZEsSuPiRPgYWE6Ar15gkh21czuGA294ssYy9+A+heTA@mail.gmail.com>
Hi. After reading the proposal and the thread, I think it may be
interesting to separate the two problems this proposal attempt to
resolve:

1) Single file library
2) Single file executable

For the first case, considering that there's currently support for
handling the library and module definitions in the main source file,
I'd say there's no need for any change in the spec to support it,
since (considering the example in DEP file), hello-world.lid doesn't
include any extra information not already available in this
hello-world.dylan:

----

Module: hello-world

define libary hello-world
  use common-dylan;
  use io;
end;

define module hello-world
  use common-dylan;
  use format-out;
end;

format-out("Hello, world!\n");

----

So it'd just be a matter of allowing the compiler to build the file
directly with:

dylan-compiler -build hello-world.dylan

If we want to make Dylan easier to catch for newcomers, then we can
make make-dylan-app generate this code layout by default.

On the other hand, there's point 2) Single file executable. The
question here is if even this code structure is too complex for
scripting. I'd say it could be simplified, since when you're scripting
you don't need to 'create' interfaces or 'export' modules, etc. For
such a case, a simplified syntax could be added, and I think it would
be valuable, but I'd go with hannes first proposal:

- only strive for the simple case, without options - and use a , as separator

If you need something more complex, go to the default library/module
definition syntax. Thus, a simple script would be:

----

Module: hello-world
Use-Libraries: common-dylan, io
Use-Modules: common-dylan, format-out

format-out("Hello, world!\n");

----

If this presents problems in even the most simple cases (e.g. due to
common-dylan exporting format-to-string), then i guess that case
should be fixed instead of adding complexity to the spec.

Cheers

2013/2/19 Carl Gay <[email protected]>:
> On Sat, Feb 16, 2013 at 11:00 PM, Carl Gay <[email protected]> wrote:
>>
>> Hi.  I would like to get feedback on a proposal for a way to define Dylan
>> libraries with a single file rather than the current minimum three files:
>> LID file, library file, main program file.  You can read it formatted and
>> reply here with your comments, or plain and leave your comments directly in
>> the document.  The latter requires a github account.
>>
>> Thanks.
>> -Carl
>>
>
> There is a new draft at a new location:
>
> http://opendylan.org/proposals/dep-0006.html
>
> Changes:
> * Added a Revision History link so you can see detailed changes.
> * Switched from multiple Use-Library/Module headers to single
> Use-Libraries/Modules.
> * Renamed Module-Exports header to Export-Names.
>
>
> _______________________________________________
> hackers mailing list
> [email protected]
> https://lists.opendylan.org/mailman/listinfo/hackers
>
_______________________________________________
hackers mailing list
[email protected]
https://lists.opendylan.org/mailman/listinfo/hackers
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.