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

Add simple use example #4497

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Add simple use example #4497

wants to merge 1 commit into from

Conversation

librasteve
Copy link
Contributor

The problem

Recently on the Discord beginner channel, a user was confused by the detailed Package / Module features and documentation

Solution provided

Create a minimal example to declare and call a class in an external file in the same dir.

@lizmat
Copy link
Collaborator

lizmat commented Jul 4, 2024

Feels like at this point, it should also be mentioned (or at least referred to) on setting up a module for proper installation, and tools such as App::Mi6

@librasteve
Copy link
Contributor Author

librasteve commented Jul 4, 2024

@lizmat - I certainly get the point of Mi6 ... but I feel that this is a tool for those that want to make a module and that are reading the relevant docs page already - which may be one of these:

for example in the Introductory section we have:
https://docs.raku.org/language/modules <=== here be the gold
https://docs.raku.org/language/module-packages
https://docs.raku.org/language/modules-extra

and then in the Reference section we have:
https://docs.raku.org/language/module-packages

don't know if you watch raku-beginner - I am just taking a whiney person at face value - and yet agreeing that the minimal variant of use should be set out somewhere

the '101' somewhere that we chose is actually imo a backwater so this PR is not going to be too helpful to the casual arriver

actually calling subs from another file is a bit odd - but I tried to be nice and not push back on that since I know raku is very lightweight for this kind of thing

@librasteve
Copy link
Contributor Author

librasteve commented Jul 6, 2024

@lizmat, I see that I have been unable to convince you that this PR is a standalone minimal example for beginners who care about splitting code over multiple files --- my comment about is to try and separate this PR from the wider wiork that needs doing for package/module docs in general and I believe that referencing how to build a module (with Mi^ or any other way) doesn't belong here

I hope that you will come to see that adding in references to "how to build a module" pages reduces the simplicity, brevity and purity of raku in "minimal multi file mode" and urge you to allow this merge forward as written - or at least relent on the basis that the perfect (wider project on improving modules docs) is the enemy of the good (this short response to a newb concern)

or, feel free to make changes if you prefer

either way, please comment here and I will close this PR either way


The C<-I.> directive tells the raku interpreter to look in directory C<.>.

=begin code
Copy link
Collaborator

@coke coke Jul 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lang<shell> so we don't try to compile it

=head1 Calling a raku method from another file

To call a raku subroutine from another file, the convention is to have a minimal
raku module or class file.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To address @lizmat's concern, maybe we can note this is intended to be a simplistic example and point to how to write a module for a more... realistic? larger? example?

@dontlaugh dontlaugh changed the title Add simple use example Add simple use example Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants