Yeah, I’m looking for a compile snippet function as I’m only working with 
expression and not complete modules.
On Friday, August 8, 2025 at 7:08:46 AM UTC-4 José Valim wrote:

> That's what the compiler does, as long as the code is compiled. It is not 
> the job of a parser to do this.
>
>
> *José Valimhttps://dashbit.co/ <https://dashbit.co/>*
>
>
> On Fri, Aug 8, 2025 at 1:07 PM benjamin...@gmail.com <
> benjamin...@gmail.com> wrote:
>
>> Yeah, I should have been clearer, I'm looking for const evaluation of 
>> expressions e.g 
>>
>> iex> Code.string_to_quoted!("1+2*3")
>> 7
>>
>> On Wednesday, August 6, 2025 at 4:19:44 PM UTC-4 José Valim wrote:
>>
>>> I believe we do it for certain functions in Elixir's stdlib and the 
>>> Erlang compiler (which we invoke) does it too.
>>>
>>>
>>> *José Valimhttps://dashbit.co/ <https://dashbit.co/>*
>>>
>>>
>>> On Wed, Aug 6, 2025 at 10:00 PM benjamin...@gmail.com <
>>> benjamin...@gmail.com> wrote:
>>>
>>>> AFAIK, then the compiler does not perform const evaluation.
>>>>
>>>> iex(9)> quote(do: 1+2*3)
>>>> {:+, [context: Elixir, imports: [{1, Kernel}, {2, Kernel}]],
>>>>  [1, {:*, [context: Elixir, imports: [{2, Kernel}]], [2, 3]}]}
>>>>
>>>> iex(10)> quote(do: 1+2*3)
>>>> 7
>>>>
>>>> Are there any plans to implement this, if not what is the recommended 
>>>> approach to do this, when working on an AST.
>>>>
>>>> -- 
>>>> You received this message because you are subscribed to the Google 
>>>> Groups "elixir-lang-core" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>> an email to elixir-lang-co...@googlegroups.com.
>>>> To view this discussion visit 
>>>> https://groups.google.com/d/msgid/elixir-lang-core/b7b48090-7022-4f14-b92b-2732272fc151n%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/elixir-lang-core/b7b48090-7022-4f14-b92b-2732272fc151n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "elixir-lang-core" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to elixir-lang-co...@googlegroups.com.
>>
> To view this discussion visit 
>> https://groups.google.com/d/msgid/elixir-lang-core/4f39f203-881f-4019-8a75-7724884e864an%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/elixir-lang-core/4f39f203-881f-4019-8a75-7724884e864an%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elixir-lang-core+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/elixir-lang-core/5b289b72-de60-4d77-bf4f-dbc6ba79c328n%40googlegroups.com.

Reply via email to