# Altering parse/eval behavior without overriding methods in base

**URL:** <https://discourse.julialang.org/t/altering-parse-eval-behavior-without-overriding-methods-in-base/17290>\
**Category:** Internals & Design\
**Tags:** question\
**Created:** [November 8, 2018, 3:06am UTC](https://discourse.julialang.org/t/altering-parse-eval-behavior-without-overriding-methods-in-base/17290 "2018-11-08T03:06:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![WschW](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wschw/32/6575_2.png) [@WschW](https://discourse.julialang.org/u/WschW)\
**Post date:** [November 8, 2018, 3:06am UTC](https://discourse.julialang.org/t/altering-parse-eval-behavior-without-overriding-methods-in-base/17290/1 "2018-11-08T03:06:31Z")

</div>

I have noticed that it is possible to alter how code typed into the REPL is interpreted without overriding methods in base. I am uncertain as to whether or not this is intended behavior but suspect it is not.

```nohighlight
julia> macro int128_str(x); "Surprise!"; end
@int128_str (macro with 1 method)

julia> 1111111111111111111111111
"Surprise!"

```

It appears that Meta.parse does not currently annotate module path information, for example:

```julia
julia> Meta.parse("1111111111111111111111111")
:(@int128_str "1111111111111111111111111")

```

instead of `:(Base.@int128_str "1111111111111111111111111")`

```nohighlight
julia> versioninfo()
Julia Version 1.0.0
Commit 5d4eaca0c9 (2018-08-08 20:58 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin14.5.0)
  CPU: Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.0 (ORCJIT, haswell)

```

---

<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:** [November 8, 2018, 3:12am UTC](https://discourse.julialang.org/t/altering-parse-eval-behavior-without-overriding-methods-in-base/17290/2 "2018-11-08T03:12:34Z")

</div>

That does indeed look incorrect. Perhaps you can even fix it ([https://github.com/JuliaLang/julia/blob/05fb47d83915d94912dd3dad783fac037125e07e/src/julia-parser.scm#L411-L443](https://github.com/JuliaLang/julia/blob/05fb47d83915d94912dd3dad783fac037125e07e/src/julia-parser.scm#L411-L443))

---

<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:** [November 8, 2018, 3:15am UTC](https://discourse.julialang.org/t/altering-parse-eval-behavior-without-overriding-methods-in-base/17290/3 "2018-11-08T03:15:45Z")

</div>

If I recall correctly, this was intentional so that you can change the behavior of integer literals in your module if you want to.

---

<div class="post-metadata">

**Author:** ![WschW](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wschw/32/6575_2.png) [@WschW](https://discourse.julialang.org/u/WschW)\
**Post date:** [November 8, 2018, 3:42am UTC](https://discourse.julialang.org/t/altering-parse-eval-behavior-without-overriding-methods-in-base/17290/4 "2018-11-08T03:42:24Z")

</div>

If the goal is to allow for changing the behavior of integer literals in your module, then I am not certain that this is the best way of achieving this. It would only work for values in certain size ranges (all of which are greater than Int64).

---

<div class="post-metadata">

**Author:** ![jeff.bezanson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jeff.bezanson/32/48_2.png) [@jeff.bezanson](https://discourse.julialang.org/u/jeff.bezanson)\
**Post date:** [November 8, 2018, 6:03am UTC](https://discourse.julialang.org/t/altering-parse-eval-behavior-without-overriding-methods-in-base/17290/5 "2018-11-08T06:03:40Z")

</div>

Yes, I think we can just change this in 1.1. I highly doubt anybody is relying on this (famous last words?)
