testcocoon has quit [Quit: Coyote finally caught me]
testcocoon has joined #ocaml
Yoric has joined #ocaml
yacks has quit [Ping timeout: 246 seconds]
yacks has joined #ocaml
Kakadu has quit [Ping timeout: 260 seconds]
jbrown has joined #ocaml
cdidd has quit [Ping timeout: 252 seconds]
asmanur_ has quit [Ping timeout: 252 seconds]
asmanur has joined #ocaml
ggole_ has joined #ocaml
ggole has quit [Ping timeout: 264 seconds]
Kakadu has joined #ocaml
Watcher7|off is now known as Watcher7
wwilly has joined #ocaml
tane has quit [Quit: Verlassend]
Drup has joined #ocaml
ontologiae has quit [Ping timeout: 268 seconds]
Drup has quit [Ping timeout: 256 seconds]
Watcher7 is now known as Watcher7|off
Anarchos has joined #ocaml
Drup has joined #ocaml
ollehar has joined #ocaml
jcao219_ has joined #ocaml
_andre has joined #ocaml
Watcher7|off is now known as Watcher7
eikke has quit [Ping timeout: 256 seconds]
ontologiae has joined #ocaml
dsheets has joined #ocaml
tane has joined #ocaml
Neros has joined #ocaml
eikke has joined #ocaml
ollehar has quit [Ping timeout: 255 seconds]
wwilly has quit [Read error: Connection reset by peer]
wwilly has joined #ocaml
dsheets has quit [Ping timeout: 258 seconds]
tane has quit [Remote host closed the connection]
<gasche>
djcoin: the recommend way is *not* to create a syntax extension
<gasche>
syntax extension are generally frowned upon as leading to syntax fragmentation and being hard to deploy among users
<gasche>
take time to design a clean library instead
<ousado>
gasche: that sounds like a very general statement to me
<djcoin>
gasche: but it seems awesome to have to have such a powerful tool. I understand that composability may be an issue, bu
<djcoin>
s/to have to have/to be
<djcoin>
but this should really be avoided then ? too bad
<gasche>
ousado: indeed, this is a very general statement
wmeyer has joined #ocaml
<wmeyer>
hu
<gasche>
right now, the weather report says that syntax extensions should be avoided
<gasche>
the tide may turn
<wmeyer>
s/hu/hi/
<Drup>
If you're talking about camlp4, the problem is that you often break code indentation and coloration.
<gasche>
(there's been a recent surge of work on lightweight macros, eg. in Rust and Scala)
<ousado>
I find myself using metaprogramming a lot, and it adds great readability to programs, IMNSHO
<gasche>
(but my gut feeling is that they're likely to discover that they have the same problem as Lisp, and need to go the heroic fortified Racket route)
<gasche>
ousado: what kind of metaprogramming?
<gasche>
usage case reports would be interesting
<djcoin>
gasche: what is this heroic fortified racket route ?
<gasche>
"Fortified Macros", etc.
<ousado>
type-driven code generation, mostly, but also DSLs for things like building html-like structures declaratively etc.
<gasche>
ousado: none of that requires syntax extensions, does it?
<gasche>
for the DSL thing, quasiquotations are nice
<ousado>
depends on the language and how flexible the syntax is
<gasche>
(I think they should be included in the syntax: look ma, no extension!)
<ousado>
for those two things, no
<gasche>
Macros give you the ultimate power wrt. syntax extensibility
<gasche>
but also the worse problems
UncleVasya has joined #ocaml
<gasche>
I think language designers should aim at the middle-ground, where usage patterns that have been recognized as widely useful yet well-behaved are included in a controlled manner
<gasche>
djcoin: the Racket people have a lot of papers on their Macro work
<gasche>
it's very good work, fairly interesting
<djcoin>
Yeah, I guess so ! :)
<ggole_>
Macros are fantastic for making up for language deficiencies
<gasche>
but you also discover what they did *not* have when reading the papers
<ggole_>
I don't think they make a good substitute for solid design though
<gasche>
eg. they did *not* have reasonable error reporting until that "Fortified Macro" paper I was referring to
<gasche>
which was in, I don't remember exactly, maybe 2008
<ousado>
.. but if you have some "native" syntax, that doesn't behave natively, it's a "semantic extension" which isn't necessarily better than a syntax extension
<gasche>
mostly everyone else that tells you about macro has sucky error reporting
<ggole_>
If you don't change the semantics, why do you need the macro?
<djcoin>
Well, macros remind me of a talk of a famous guy that I saw a few days ago, on "empowering users" of a language (he was talking about the java pl). How you should give the community the maximum of tools so they can make the language grow by themselves. I guess macros are outstanding
<ggole_>
Unless you're just doing staged computation, I guess
<gasche>
djcoin: Guy Steele
<djcoin>
gasche: yeah!
<gasche>
look at how it worked for Java
<djcoin>
yeah but java was maybe already doomed by other things
<ggole_>
The thing about macro facilities is that they get very heavily used in languages which have them
<ggole_>
It indicates some kind of need
<gasche>
or abuse
<ggole_>
Even in C, in which macros are *horrific*
<ggole_>
People still use the hell out of them
<gasche>
the number of times were I've seen Lisp people use macros where a simple functions would do is frightening
<gasche>
but yeah
<djcoin>
gasche: you said at some point, that macro were some lisp propaganda and taht you can also use it in a typed language. Too bad it is discouraged
<ggole_>
Sure
<flux>
I today used C macros to generate dozens if not hundreds of functions!
<ousado>
I think it's very reasonable to ideantify solutions that may or may not require some boilerplate, and then to ease the burden for the programmer in the boilerplate case by providing a macro
<ousado>
*identify
<flux>
wish C had first class/higher order macros, though
<Drup>
ousado: can't you do that with high order functions most of the time ?
<wmeyer>
Ok, let me re-itarate it again, macros allow the highest abstraction available, embedded DSLs in the language
<ousado>
Drup: not for the applications I'm using macros for currently
<wmeyer>
they also at the same time allow code generation
<wmeyer>
therefore they are very powerful tool
<Drup>
ousado: like metaprogramming ?
<ousado>
Drup: and there's a cost to very sophisticated abstractions, too
<ousado>
yes
<wmeyer>
unfortunately they come with some cost, since the code inside macros is in the same as host language, the analysis or any automatic comprehension of it is not possible
<wmeyer>
with dependent types it's possible to have flavour of full embeded language, with type system reusing host type system for free, using some higher order encodings like PHOAS
<wmeyer>
but then we are doing at runtime what can be done with macros statically (building an interpreter for the object language)
<rks>
wmeyer: PHOAS ?
<ousado>
wmeyer: and I already thought that's a call for machine-comprehensible meta-macro-DSLs
<ggole_>
Do the racket macro system help obviate the need to write code walking machinery?
<ggole_>
I wrote a value generation macro a while back, and in order to get it exactly write I had to know whether a form would be evaluated
<ggole_>
And defmacro provides no help there
<ggole_>
Not to mention being very low level in general
<ggole_>
s/write/right/
Anarchos has quit [Quit: Vision[0.9.7-H-090423]: i've been blurred!]
<rks>
wmeyer: thanks
<wmeyer>
rks: you are welcome
<ousado>
but I fully agree that anything that can be covered using the host language syntax should go that route. both from an implementors perspective as well as from a users perspective, since one can use standard terminology to communicate which construct does what
<wmeyer>
ousado: in the simpliest case, what can't be done already is abstractinon over [let binders]
awm22 has quit [Quit: Leaving.]
<wmeyer>
means they are not first class
<wmeyer>
with CPS however it's easier, but nobody wants to write code in CPS
<ousado>
wmeyer: mm is it possible you skipped the 'syntax' when reading 'using the host language syntax'?
<ousado>
otherwise I think I don't understand what you mean
jcao219_ has quit [Ping timeout: 256 seconds]
ollehar has joined #ocaml
<wmeyer>
ousado: macros are generated (at least in Lisp) in the same language, in the lisp, so here i am implying that it's also turing complete, therefore any sort of IDE will not work anymore, (well unless we will have something like SLIME)
<ousado>
wmeyer: ah, you were referring to the machine-tractability part?
awm22 has joined #ocaml
smondet has joined #ocaml
testcocoon has quit [Quit: Coyote finally caught me]
<wmeyer>
ousado: machine tractability? yes, I say here is how difficult to support IDEs without executing macros
<wmeyer>
Slime sorts this out by having a repl that is an integral part of the IDE
awm22 has quit [Quit: Leaving.]
eikke has quit [Ping timeout: 256 seconds]
awm22 has joined #ocaml
awm22 has quit [Read error: Connection reset by peer]
awm221 has joined #ocaml
<ousado>
yes.. but it's a general problem, that can only be solved by providing the IDE with something it's able to make sense of, I think
<chris2>
i'm converting a small program to use Core, and go a [ `Deprecated_use_in_channel ] error... which i/o library is recommended and how to i get ocamllex to speak with it?
<orbitz>
chris2: Core.Std.In_channel
<chris2>
that won't work with Lexing.from_channel i guess?
<orbitz>
I've never used ocamllex
<orbitz>
you could just not use Core in that small piece of code?
<chris2>
yeah
<chris2>
i just use a Result.t later
<chris2>
i just qualified the module for now
<orbitz>
Ah, are you doing open Core.Std inthat code?
<chris2>
yeah
<orbitz>
you could just do module Result = Core.Std.Result;;
<chris2>
yep
<chris2>
it's just a small driver, no problem
<chris2>
i can use core in the rest :)
<orbitz>
yeah
<orbitz>
that's usually what I do too :)
Neros has quit [Read error: Connection reset by peer]
Neros has joined #ocaml
breakds has joined #ocaml
<chris2>
hmm, now how do i make Map.iter grok Result?
<pippijn>
chris2: you can use Lexing.from_function
UncleVasya has quit [Quit: UncleVasya]
<chris2>
hm, i see
eikke has joined #ocaml
darkf has quit [Quit: Leaving]
milosn has quit [Read error: Operation timed out]
milosn has joined #ocaml
eikke has quit [Ping timeout: 276 seconds]
raichoo has quit [Quit: leaving]
eikke has joined #ocaml
Neros_ has joined #ocaml
Neros has quit [Read error: Connection reset by peer]
eikke has quit [Ping timeout: 264 seconds]
zpe has quit [Remote host closed the connection]
Yoric has quit [Ping timeout: 272 seconds]
ttamttam has quit [Quit: ttamttam]
Neros_ has quit [Ping timeout: 258 seconds]
breakds has quit [Quit: Konversation terminated!]
Neros has joined #ocaml
ben_zen has quit [Ping timeout: 252 seconds]
eikke has joined #ocaml
tane has joined #ocaml
mbac has quit [Quit: die without knowing]
ben_zen has joined #ocaml
ttamttam has joined #ocaml
hkBst has quit [Quit: Konversation terminated!]
Neros has quit [Ping timeout: 245 seconds]
djcoin has quit [Quit: WeeChat 0.3.9.2]
zpe has joined #ocaml
zpe has quit [Ping timeout: 245 seconds]
ollehar has quit [Ping timeout: 245 seconds]
awm221 has quit [Quit: Leaving.]
Yoric has joined #ocaml
ollehar has joined #ocaml
Kakadu has quit []
Watcher7 is now known as Watcher7|off
cdidd has joined #ocaml
emmanuelux has joined #ocaml
raichoo has joined #ocaml
pkrnj has joined #ocaml
othiym23 has quit [Quit: WeeChat 0.3.8]
ontologiae has quit [Ping timeout: 255 seconds]
Drup has quit [Ping timeout: 264 seconds]
Kakadu has joined #ocaml
othiym23 has joined #ocaml
Kakadu has quit [Ping timeout: 255 seconds]
Kakadu_ has joined #ocaml
Yoric has quit [Ping timeout: 245 seconds]
chrisdotcode has joined #ocaml
chrisdotcode_ has quit [Ping timeout: 256 seconds]
ggole_ has quit []
Drup has joined #ocaml
ollehar has quit [Ping timeout: 264 seconds]
eikke has quit [Ping timeout: 258 seconds]
Yoric has joined #ocaml
Neros has joined #ocaml
smondet has quit [Remote host closed the connection]
smondet has joined #ocaml
ttamttam has left #ocaml []
ollehar has joined #ocaml
awm22 has joined #ocaml
pkrnj has quit [Quit: Computer has gone to sleep.]
testcocoon has joined #ocaml
smondet has quit [Remote host closed the connection]
ulfdoz has joined #ocaml
pkrnj has joined #ocaml
pkrnj has quit [Quit: Computer has gone to sleep.]
emmanuel__ has joined #ocaml
emmanuel__ has quit [Read error: Connection reset by peer]
emmanuelux has quit [Remote host closed the connection]
emmanuelux has joined #ocaml
nantralien has joined #ocaml
ollehar has quit [Ping timeout: 252 seconds]
Watcher7|off is now known as Watcher7
gautamc has joined #ocaml
awm221 has joined #ocaml
awm22 has quit [Read error: Connection reset by peer]
Yoric has quit [Ping timeout: 245 seconds]
raichoo has quit [Quit: leaving]
_andre has quit [Quit: leaving]
Yoric has joined #ocaml
<IbnFirnas>
chris2: In_channel.create works fine with Lexing.from_channel
pkrnj has joined #ocaml
Kakadu_ has quit []
Yoric has quit [Ping timeout: 258 seconds]
eikke has joined #ocaml
tane has quit [Quit: Verlassend]
dsheets has quit [Ping timeout: 258 seconds]
Tobu has quit []
nantralien is now known as Anarchos
jbrown has quit [Ping timeout: 256 seconds]
q66 has quit [Remote host closed the connection]
ulfdoz has quit [Ping timeout: 258 seconds]
chrisdotcode has quit [Ping timeout: 245 seconds]
Tobu has joined #ocaml
atamagawarui has joined #ocaml
walter|r has quit [Quit: This computer has gone to sleep]
atamagawarui has quit [Quit: Brain.sys has encountered a problem and needs to close. We are sorry for the inconvenience.]
walter|r has joined #ocaml
yacks has quit [Ping timeout: 264 seconds]
maurer has joined #ocaml
<maurer>
Anyone familiar with ocaml lex/yacc know how to get a more descriptive error message out of it?
<maurer>
Parse_error doesn't tell me what token/grammar rule wasn't working
<maurer>
Or where in the file it was when it failed
<Anarchos>
maurer: there is a debug flag for both tools
<Anarchos>
-d if i am correc
<maurer>
Anarchos: I'm trying to debug the parser post-compilation, but a friend pointed out OCAMLRUNPARAM=p which seems what I need
<Anarchos>
ok it does the job yes
<Anarchos>
maurer: it is mentioned in the ref manual if you need more info
ollehar has joined #ocaml
awm221 has quit [Quit: Leaving.]
walter|r has quit [Quit: This computer has gone to sleep]