Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List files in directory #118

Closed
Lartu opened this issue Jun 19, 2019 · 12 comments
Closed

List files in directory #118

Lartu opened this issue Jun 19, 2019 · 12 comments
Labels
enhancement Make a feature we already have better feature request Please add this to the language! good first issue Good for newcomers

Comments

@Lartu
Copy link
Owner

Lartu commented Jun 19, 2019

While we provide ways to read from and write to files in directories, we don't provide any ways to LIST the contents of a directory. We need that in LDPL.

I'd recommend some syntax like
LIST CONTENTS OF DIRECTORY <string-expression> IN <string-list>

It should be portable, though, and that's where the problem lies. Any thoughts? Should we go ahead and just execute ls -l under linux and dir in windows and parse accordingly or any of you has got any better ideas? 🤔

@Lartu Lartu added enhancement Make a feature we already have better feature request Please add this to the language! good first issue Good for newcomers labels Jun 19, 2019
@arielf212
Copy link
Contributor

arielf212 commented Jun 19, 2019

I don't think this should have special syntax, especially since we already have a way to do this easily, as you have already mentioned.

@dgarroDC
Copy link
Collaborator

I would be nice to haven a cross platform way of doing it.

@Lartu
Copy link
Owner Author

Lartu commented Jun 19, 2019

I don't think this should have special syntax, especially since we already have a way to do this easily, as you have already mentioned.

What way? 🤔 In fact I realized we were lacking this because I needed a way to load all files in a directory and I noticed I had no way of knowing what files were there.

@Lartu
Copy link
Owner Author

Lartu commented Jun 19, 2019

Added in 4582c77. The syntax is the one suggested above. On my way to document it.

@Lartu Lartu closed this as completed Jun 19, 2019
@Lartu
Copy link
Owner Author

Lartu commented Jun 19, 2019

Documented here.

@arielf212
Copy link
Contributor

it took me some time, but I managed to do it.
here is my implementation of getting files inside directories using just ldpl, which you can take a look at if you want. it is cross-platform too.

@Lartu
Copy link
Owner Author

Lartu commented Jun 19, 2019

Woah, this is wonderful! I added the statement to keep the language simple to use, but what you've done is incredible!! Kudos to you!

@Lartu
Copy link
Owner Author

Lartu commented Jun 19, 2019

You know, @fireasembler, one of the things I like the most about developing LDPL (with you all) is when people like you or @dvkt or @carbontwelve come and show me things at the moment I didn't think were possible with LDPL. Not only it is a great satisfaction to see what the language is capable of, but it makes me very happy to be surrounded with such capable people (and, on top of that, interested in the language). So, doble kudos and thanks to you all!

That said, I was thinking that using what you've written you could write a library to check the current operating system. That'd be really useful!

(Also, I'm using your CSVLibrary for a univeristy project I'm working on, so thanks for that!)

@arielf212
Copy link
Contributor

@Latru It's just that I think that adding too many statements to the language will make it too complex for it's own needs.
Maybe adding a macro system to allow for user defined statements will be better?

@Lartu
Copy link
Owner Author

Lartu commented Jun 20, 2019

While that is true, I do love when languages are a big toolbox that have things already cooked and done for you. When I want to read a CSV I don't want to program myself a CSV library, I want to read said CSV and get stuff done. PHP is great in this, Python too. I would like that kind of "I can use this language to do this and this easily" in LDPL. Despite its limitations.

@arielf212
Copy link
Contributor

Then maybe introducing a standard library would be a better choice.

I am just worried that adding too many things as keywords (or in our case, key sentences) will make the language too hard to read and use. It's already really hard to find the thing I need in the documentation.

@Lartu
Copy link
Owner Author

Lartu commented Jun 20, 2019

Hmmm... well in that case we may need not only a standard library, but also a better documentantion. I agree with you, a lib may be in order.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Make a feature we already have better feature request Please add this to the language! good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants