Skip to content

Commit 670ea5d

Browse files
authored
A few wording tweaks
1 parent d7837dc commit 670ea5d

File tree

1 file changed

+8
-15
lines changed

1 file changed

+8
-15
lines changed

README.md

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,6 @@
22

33
For older versions of Julia, see https://github.com/MikeInnes/Requires.jl/blob/5683745f03cbea41f6f053182461173e236fdd94/README.md
44

5-
6-
7-
Requires now needs a UUID, and must be called from within your packages `__init__` function. For example:
8-
9-
```julia
10-
function __init__()
11-
@require JSON="682c06a0-de6a-54ab-a142-c8b1cf79cde6" do_stuff()
12-
end
13-
```
14-
155
# Requires.jl
166

177
[![Build Status](https://travis-ci.org/MikeInnes/Requires.jl.svg?branch=master)](https://travis-ci.org/MikeInnes/Requires.jl)
@@ -26,7 +16,7 @@ but suppose you want to provide additional functionality if the `Gadfly` package
2616
Requires.jl exports a macro, `@require`, that allows you to specify that some code is conditional on having both packages available.
2717

2818
`@require` must be within the [`__init__`](https://docs.julialang.org/en/v1/manual/modules/#Module-initialization-and-precompilation-1) method for your module.
29-
Here's an example that will create a new method of a function called `media` only when both packages are present:
19+
Here's an example that will create a new method of a function called `myfunction` only when both packages are present:
3020

3121
```julia
3222
module MyPkg
@@ -42,12 +32,12 @@ end
4232
end # module
4333
```
4434

45-
`Gadfly` is the name of the package, and the value in the string is the UUID which may be obtained
35+
The value in the string is Gadfly's UUID; this information may be obtained
4636
by finding the package in the registry ([JuliaRegistries](https://github.com/JuliaRegistries/General) for public packages).
4737
Note that the `Gadfly.Plot` type may not be available when you load `MyPkg`, but `@require`
4838
handles this situation without trouble.
4939

50-
For larger amounts of code you can use `include` inside the `@require` statement:
40+
For larger amounts of code you can use `include` as the argument to the `@require` statement:
5141

5242
```julia
5343
function __init__()
@@ -66,6 +56,8 @@ end
6656

6757
if you wish to exploit precompilation for the new code.
6858

59+
## Demo
60+
6961
For a complete demo, consider the following file named `"Reqs.jl"`:
7062

7163
```julia
@@ -80,8 +72,7 @@ end
8072
end
8173
```
8274

83-
Here's a complete demo using this file (note that if this were a registered package you could
84-
replace the first two commands with `using Reqs`):
75+
Here's a session that shows how `Colors` is only loaded after you've imported `JSON`:
8576

8677
```julia
8778
julia> include("Reqs.jl")
@@ -100,3 +91,5 @@ Colors
10091
julia> Reqs.Colors.RGB(1,0,0)
10192
RGB{N0f8}(1.0,0.0,0.0)
10293
```
94+
95+
Note that if `Reqs` were a registered package you could replace the first two commands with `using Reqs`.

0 commit comments

Comments
 (0)