Skip to content

Commit f9e4db9

Browse files
committed
Use positional instead of keyword arguments for EachLine
1 parent c83bef0 commit f9e4db9

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

base/deprecated.jl

-2
Original file line numberDiff line numberDiff line change
@@ -1809,8 +1809,6 @@ eval(LibGit2, quote
18091809
end
18101810
end)
18111811

1812-
@deprecate EachLine(stream, ondone) EachLine(stream, ondone=ondone)
1813-
18141812
# These conversions should not be defined, see #19896
18151813
@deprecate convert{T<:Number}(::Type{T}, x::Dates.Period) convert(T, Dates.value(x))
18161814
@deprecate convert{T<:Dates.Period}(::Type{T}, x::Real) T(x)

base/io.jl

+3-3
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ type EachLine
543543
ondone::Function
544544
chomp::Bool
545545

546-
EachLine(stream::IO=STDIN; ondone::Function=()->nothing, chomp::Bool=true) =
546+
EachLine(stream::IO=STDIN, ondone::Function=()->nothing, chomp::Bool=true) =
547547
new(stream, ondone, chomp)
548548
end
549549

@@ -558,11 +558,11 @@ removed. When called with a file name, the file is opened once at the beginning
558558
iteration and closed at the end. If iteration is interrupted, the file will be
559559
closed when the `EachLine` object is garbage collected.
560560
"""
561-
eachline(stream::IO=STDIN; chomp::Bool=true) = EachLine(stream, chomp=chomp)::EachLine
561+
eachline(stream::IO=STDIN; chomp::Bool=true) = EachLine(stream, ()->nothing, chomp)
562562

563563
function eachline(filename::AbstractString; chomp::Bool=true)
564564
s = open(filename)
565-
EachLine(s, ondone=()->close(s), chomp=chomp)::EachLine
565+
EachLine(s, ()->close(s), chomp)
566566
end
567567

568568
start(itr::EachLine) = nothing

test/iterators.jl

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ end
2929
let b = IOBuffer("foo\n")
3030
@test collect(EachLine(b)) == ["foo"]
3131
seek(b, 0)
32-
@test collect(EachLine(b, chomp=false)) == ["foo\n"]
32+
@test collect(EachLine(b, ()->nothing, false)) == ["foo\n"]
3333
seek(b, 0)
34-
@test collect(EachLine(b, ondone=()->0)) == ["foo"]
34+
@test collect(EachLine(b, ()->0)) == ["foo"]
3535
seek(b, 0)
36-
@test collect(EachLine(b, chomp=false, ondone=()->0)) == ["foo\n"]
36+
@test collect(EachLine(b, ()->0, false)) == ["foo\n"]
3737
end
3838

3939
# enumerate (issue #6284)

0 commit comments

Comments
 (0)