[erlang-questions] erl, escript, shebangs and syntax errors
Maxim Treskin
zerthurd@REDACTED
Fri Sep 30 04:32:08 CEST 2011
Programming is not an intuitive job, people are not programmed from birth,
so there is different ways to be intuitive for different people. For example
I see nothing intuitive to mix escript code and code for OTP. If you want to
use common library in OTP application and escript, put following line after
shebang line:
%%! -pa path/to/library
On 30 September 2011 09:07, Andrew Pennebaker
<andrew.pennebaker@REDACTED>wrote:
> No. erl should ignore shebang lines, because that's easy to do in a parser,
> and it makes the language more intuitive to program in.
>
>
> Cheers,
>
> Andrew Pennebaker
> www.yellosoft.us
>
> On Thu, Sep 29, 2011 at 9:33 PM, Maxim Treskin <zerthurd@REDACTED> wrote:
>
>> You should not compile this script, just run. Remove first line If you
>> want compile it as regular erlang module.
>>
>> On 30 September 2011 01:25, Andrew Pennebaker <
>> andrew.pennebaker@REDACTED> wrote:
>>
>>> Please instruct erl to ignore shebangs.
>>>
>>> $ cat hello.erl
>>> #!/usr/bin/env escript
>>>
>>> -module(hello).
>>> -export([main/1]).
>>>
>>> main(_) -> io:format("Hello World!~n", []).wonko:Desktop andrew$
>>> ./hello.erl
>>> Hello World!
>>> wonko:Desktop andrew$ erl
>>> Erlang R14B03 (erts-5.8.4) [source] [64-bit] [smp:2:2] [rq:2]
>>> [async-threads:0] [hipe] [kernel-poll:false]
>>>
>>> Eshell V5.8.4 (abort with ^G)
>>> 1> c(hello).
>>> ./hello.erl:1: syntax error before: '#'
>>> ./hello.erl:4: no module definition
>>> error
>>>
>>> Cheers,
>>>
>>> Andrew Pennebaker
>>> www.yellosoft.us
>>>
>>> _______________________________________________
>>> erlang-questions mailing list
>>> erlang-questions@REDACTED
>>> http://erlang.org/mailman/listinfo/erlang-questions
>>>
>>>
>>
>>
>> --
>> Maxim Treskin
>>
>
>
--
Maxim Treskin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110930/badf444e/attachment.htm>
More information about the erlang-questions
mailing list