# Inconsistencies in some methods and more

**URL:** <https://discourse.julialang.org/t/inconsistencies-in-some-methods-and-more/7788>\
**Category:** Internals & Design\
**Created:** [December 15, 2017, 2:13pm UTC](https://discourse.julialang.org/t/inconsistencies-in-some-methods-and-more/7788 "2017-12-15T14:13:30Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Iagoba\_Apellaniz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/iagoba_apellaniz/32/34406_2.png) [@Iagoba\_Apellaniz](https://discourse.julialang.org/u/Iagoba_Apellaniz)\
**Post date:** [December 15, 2017, 2:13pm UTC](https://discourse.julialang.org/t/inconsistencies-in-some-methods-and-more/7788/1 "2017-12-15T14:13:30Z")

</div>

Dear All,

I didn’t want to start a new issue in GitHub without checking first what is your opinion on this regard. I found the issue [#25098](https://github.com/JuliaLang/julia/issues/25098) by change, and I started trying to define a function named “·”. I found various things I try to explain as clear as I can.

I did my checkings in `v"0.6.2"`, since at the time of checking this, writing a middot would crash the Julia REPL (see issue [#25098](https://github.com/JuliaLang/julia/issues/25098))

First of all, it is already defined in `Base` a function called `·`.

```nohighlight
julia> (⋅)(x, y) = x * y
ERROR: error in method definition: function Base.⋅ must be explicitly imported to be extended

```

which is normal. Then,

```nohighlight
julia> methods(·)
ERROR: syntax: invalid character "·"
julia> methods(Base.·)
ERROR: syntax: invalid character "·"

```

I think things start to get confusing.

Hence, I checked other behaviours of `methods`, but this time I still use by accident the `Base.foo` naming to call some functions and I found that `+`, as probably other functions defined as operators (unary or binary), throw an error. I listed some of them,

```nohighlight
julia> methods(Base.+)
ERROR: syntax: unexpected ")"
julia> methods(Base.!)
ERROR: syntax: missing comma or ) in argument list

```

A way to avoid this is to write the colon in front of the symbol, which works almost for all cases except the conlon itself

```nohighlight
julia> methods(Base.:+)
# 182 methods for generic function "+":
···
julia> methods(Base.::)
ERROR: UndefVarError: :: not defined

```

Still I’m not able to add a method to `Base.·`.

Any suggestion for the title of this thread is welcome.

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [December 15, 2017, 2:19pm UTC](https://discourse.julialang.org/t/inconsistencies-in-some-methods-and-more/7788/2 "2017-12-15T14:19:27Z")

</div>

I think your `cdot` is not the standard one. See:

```julia
julia> '·' # Your cdot
'·': Unicode U+00b7 (category Po: Punctuation, other)

julia> '⋅' # Correct cdot
'⋅': Unicode U+22c5 (category Sm: Symbol, math)

```

Try `methods(\cdot<TAB>)<ENTER>`

This gives for me

```julia
julia> methods(⋅)
# 11 methods for generic function "dot":
dot(x::BitArray{1}, y::BitArray{1}) in Base.LinAlg at linalg/bitarray.jl:5
dot(x::Number, y::Number) in Base.LinAlg at linalg/generic.jl:675
...

```

For the second question, you can use:

```julia
julia> methods(Colon)
# 2 methods for generic function "(::Type)":
Colon() in Base at essentials.jl:321
(::Type{T})(arg) where T in Base at sysimg.jl:77

```

---

<div class="post-metadata">

**Author:** ![Iagoba\_Apellaniz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/iagoba_apellaniz/32/34406_2.png) [@Iagoba\_Apellaniz](https://discourse.julialang.org/u/Iagoba_Apellaniz)\
**Post date:** [December 15, 2017, 2:24pm UTC](https://discourse.julialang.org/t/inconsistencies-in-some-methods-and-more/7788/3 "2017-12-15T14:24:02Z")

</div>

EDIT: I’m wrong, I was using U+22c5 as @kristoffer.carlsson says

Thanks @kristoffer.carlsson!

Why then it tells me that `Base.·` (where I used the very same dot U+00b7) must be explicitly imported?

```nohighlight
julia> (⋅)(x, y) = x * y
ERROR: error in method definition: function Base.⋅ must be explicitly imported to be extended

```

This Error message made me try try it again and again. It should be changed to something like the standard error `ERROR: syntax: invalid character "·"`.

Just a comment: Would it be worth to make them equivalent in Julia. I think the answer is yes.

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [December 15, 2017, 2:28pm UTC](https://discourse.julialang.org/t/inconsistencies-in-some-methods-and-more/7788/4 "2017-12-15T14:28:48Z")

</div>

It doesn’t look like you are using U+00b7 (at least not in the message you just pasted).

---

<div class="post-metadata">

**Author:** ![Iagoba\_Apellaniz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/iagoba_apellaniz/32/34406_2.png) [@Iagoba\_Apellaniz](https://discourse.julialang.org/u/Iagoba_Apellaniz)\
**Post date:** [December 15, 2017, 2:36pm UTC](https://discourse.julialang.org/t/inconsistencies-in-some-methods-and-more/7788/5 "2017-12-15T14:36:50Z")

</div>

YOU ARE RIGHT!!

I meshed up both using copy/paste, since I was also writing for the issue [#25098](https://github.com/JuliaLang/julia/issues/25098).

Thanks, I will update the issue telling which unicode character brakes the REPL.

---

<div class="post-metadata">

**Author:** ![StefanKarpinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefankarpinski/32/24_2.png) [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)\
**Post date:** [December 15, 2017, 5:00pm UTC](https://discourse.julialang.org/t/inconsistencies-in-some-methods-and-more/7788/6 "2017-12-15T17:00:09Z")

</div>

Perhaps we should add this to our custom Unicode normalization table? See:

[https://github.com/JuliaLang/julia/pull/19464](https://github.com/JuliaLang/julia/pull/19464)

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [December 15, 2017, 5:13pm UTC](https://discourse.julialang.org/t/inconsistencies-in-some-methods-and-more/7788/7 "2017-12-15T17:13:26Z")

</div>

How do you type U+00b7? If it is easy to do by accident, we could definitely normalize it to U+22c5.

---

<div class="post-metadata">

**Author:** ![Iagoba\_Apellaniz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/iagoba_apellaniz/32/34406_2.png) [@Iagoba\_Apellaniz](https://discourse.julialang.org/u/Iagoba_Apellaniz)\
**Post date:** [December 18, 2017, 11:19am UTC](https://discourse.julialang.org/t/inconsistencies-in-some-methods-and-more/7788/8 "2017-12-18T11:19:20Z")

</div>

It is as easy as typing `SHIFT+3` in my keyboard.

I already fixed it in this PR [https://github.com/JuliaLang/julia/pull/25157](https://github.com/JuliaLang/julia/pull/25157)

It works for me, but probably it is not the most elegant way to do it.

Now working on an alternative, inspired by “WIP: custom Unicode normalization for Julia identifiers”

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [December 18, 2017, 1:27pm UTC](https://discourse.julialang.org/t/inconsistencies-in-some-methods-and-more/7788/9 "2017-12-18T13:27:27Z")

</div>

> [@Iagoba\_Apellaniz](#):
>
> It is as easy as typing SHIFT+3 in my keyboard.

Ah, I see — this is the “interpunct” character, and there are [various keyboard shortcuts for it](https://en.wikipedia.org/wiki/Interpunct#Keyboard_input), e.g. option-shift-9 on macOS.
