2011-06-21

<hcarty> gildor: Are the use_* tags generated by oasis applied to ocamldep calls?
<hcarty> Ah, maybe not enough though...
<hcarty> thelema_: It looks like it should be, according to a brief look through the generated myocamlbuild.ml
<thelema_> hcarty: maybe the myocamlbuild isn't ocamlfind enabled for ocamldep
<hcarty> gildor: This is the _oasis. The commented-out lines at the end are the relevant portion: http://0ok.org/cgit/cgit.cgi/xstrp4/tree/_oasis
<hcarty> s/ the//
<hcarty> gildor: I had tried that, but the ocamlbuild's ocamldep step failed
<gildor> hcarty: syntax extension, add the BuildDepends and add "foo.ml": syntax_camlp4o outside the OASIS section in _tags
<gildor> hcarty:
<hcarty> Pointless example: (let s = "a string!" in print_endline "$s") works in that case
<hcarty> thelema_: xstrp4.syntax.strings does interpolation for all string literals
<hcarty> Ok, xstpr4 2.0alpha3 is up on odb
<hcarty> thelema_: Does a newer tarball upload to oasis-db replace the existing unstable version?
<hcarty> thelema_: I think it's off by one - maybe the i = i + 1 line
<hcarty> gildor: Adding the findlib name to BuildDepends does not seem to work
<hcarty> gildor: How do you tell oasis to use a syntax extension on an executable? Both the extension and the executable (a test program) are built from the same _oasis.
<hcarty> flux: Asking for section 3.12 at bootstrap time should be enough
<hcarty> flux: Yes
<hcarty> That's true
<hcarty> Preferably with something less verbose than "String.copy interpolate..."
<hcarty> thelema_: You could do something like type p_t = {x : int; y : int} ... ${p, fun p -> String.copy interpolate "$p.x, $p.y"}
<hcarty> So if we let s = "foo" before that print_endline, the output would be "Interpolation in a quotation : foo"
<hcarty> xstrp4 expands quotations/interpolations to String.concat "" [...]
<hcarty> thelema_: Interestingly enough, with the "interpolate" keyword, you can do a similar embedding - print_endline <:here<Interpolation in a quotation : ${s, fun s -> String.copy interpolate "$s"}>>
<hcarty> thelema_: Possibly not. And that may be for the best.
<hcarty> Your feedback has already been a big help in digging out some corner cases
<hcarty> I'd love to have <:here<${foo, fun s -> "$s">> work, but it's not working yet
<hcarty> Says that there is an unterminated string literal
<hcarty> It doesn't get double-interpolated - camlp4 chokes on it
<hcarty> thelema_: <:here<${foo, fun s -> s ^ "bar"}>>
<hcarty> thelema_: A $ not associated with an obvious interpolation no longer needs to be quoted
<hcarty> I'm not sure how (or if I should) fix this
<hcarty> The general string interpolation can interact badly with string literals in quotations
<hcarty> thelema_: Supporting xstrp4 interpolation everywhere is proving to be a bit challenging when mixed with xstrp4-based quotations

2011-06-20

<hcarty> thelema_: When I want to replace xstrp4 with a newer version on oasis-db, is it enough to upload the newer tarball, test, and promote from unstable to testing?
<hcarty> And thank you for the xstrp4 feedback. I appreciate it.
<hcarty> thelema_: Thank you
<hcarty> thelema_: They are
<hcarty> thelema_: alpha1 is in the name for a good reason :-)
<hcarty> thelema_: \$[a-zA-Z.]+ doesn't expand to anything but $[a-zA-Z.]+ (plus the warning, of course...)
<hcarty> And the \$ escaping needs to change anyway, as OCaml gives a warning about an illegal backslash escape
<hcarty> An xstrp4-based extension could be created which acts on all strings
<hcarty> sample.ml is from the original distribution, but it should still be applicable
<hcarty> But then again I haven't used xstrp4 that much
<hcarty> thelema_: I don't generally use the interpolate form
<hcarty> Ah
<hcarty> POLS?
<hcarty> thelema_: I'm not sure how to handle that sanely
<hcarty> thelema_: That could be removed, requiring $(foo) or ${foo, ...}
<hcarty> thelema_: $foo interpolates the value foo
<thelema_> hcarty: can xstrp4 drop the need to escape $ not followed by {?
<hcarty> Doesn't look like it
<hcarty> I'll check
<hcarty> Ah, I see
<hcarty> But I didn't want to make it a firm requirement since syntax_batteries is more of a demo than anything
<hcarty> Ah, yes. That does require Batteries to use
<hcarty> thelema_: It shouldn't depend on batteries
<hcarty> thelema_: I just saw :-) I'm poking around a bit on the interface now
<hcarty> thelema_: Thank you
<thelema_> hcarty: what's the package name?
<hcarty> My modified version of xstrp4 is now odb-able. In theory at least!
<hcarty> Ok, I'll go with .tar.gz
<thelema_> hcarty: .gz better, .bz2 should work
<hcarty> thelema_: Does .tar.gz vs .tar.bz2 matter?
<hcarty> Do you know if versions like 2.0alpha1 are accepted and understood by oasis-db and odb?
<hcarty> thelema_: Cool, thanks.
<hcarty> A better question is probably - does the uploaded tarball get used directly by odb, or is it modified somehow?
<hcarty> thelema_: Does the tarball need the fully generated build system, or is the _oasis file enough?
<thelema_> hcarty: log in to ocamlforge, go here: http://oasis.ocamlcore.org/dev/upload and upload your tarball
<hcarty> thelema_: What is the process for uploading a package to the odb-ready oasis-db?
<hcarty> Something explicit would be nice though
<hcarty> adrien: From what I remember, the lablgtk translation of the Gtk tutorial does a decent implicit job of illustrating those points
<hcarty> thelema_: Quite
<hcarty> That wrapper made my (very simple) GUI needs easier.
<hcarty> I wrote this before no longer needing it: http://forge.ocamlcore.org/projects/gtk-light/
<hcarty> Probably out of a desire to match the underlying Gtk library structure
<hcarty> It wasn't bad - it's just very different from most other OCaml libraries I've used
<hcarty> I haven't used it in a while though, so I doubt that I get it anymore :-)
<hcarty> And some limited documentation, although I found that once I "got" lablgtk's structure it became easier
<hcarty> Finding the modern file chooser
<hcarty> NaCl: I hit the same problem when I first tried lablgtk
<NaCl> hcarty: indeed it is
<hcarty> NaCl: If I recall correctly, the new file chooser form is available from lablgtk. I think one of the included demos uses it.
<vivanov> hcarty: thx :)
<hcarty> vivanov: Both are available here - http://www.ocaml.info/home/ocaml_sources.html
<hcarty> vivanov: The two main ones are probably ocamlgsl and lacaml

2011-06-16

<hcarty> Protect the programmer that is... as flux said, the error messages can become cryptic and/or HUGE
<hcarty> It's worth learning! But it's important to remember that the compiler doesn't protect as nicely as it does when using a functional programming style.
<hcarty> likebike: The OO system in OCaml is very cool, but it requires a different kind of discipline from a user
<hcarty> likebike: I jumped in to OCaml's OO support early in my OCaml learning time. I thought it was very cool, used it everywhere in my code... and was then bitten horribly because I hadn't used it properly.

2011-06-15

<hcarty> (* ... *) is not a code block, so ;; isn't really appropriate. That's my excuse at least...
<hcarty> (* test *)1;; works, for example
<hcarty> EM03: You need an expression of some sort
<hcarty> EM03: You can have comments in the toplevel
<hcarty> adrien: Have a good night
<hcarty> sprintf replacement comes out of the box still, of course
<hcarty> Custom quotation handling can be added in ~17 SLOC for a simple case
<hcarty> adrien: Not a problem, just keeping you updated in case your interest continues :-)
<adrien> hcarty: I'm geniously interested but I won't have time for that until next week unfortunately
<hcarty> adrien: I may even document it soon...
<hcarty> adrien: Another xstrp4 update - Now With Even Simpler Customization
<EM03> hcarty: hey, yea I'm just toying around for the most part, see how these ocaml frameworks did it
<NaCl> hcarty / rproust: ah, cool, thanks
<Tommytom> thx hcarty but I think I can do my things with a char array ;)
<hcarty> Tommytom: If you want many bytes, you can use a Bigarray

2011-06-12

<hcarty> adrien: I hope to improve the documentation once I am reasonably happy with the framework.
<hcarty> adrien: xstrp4_here.ml and xstrp4_batteries.ml are the two currently available examples. Those plus test.ml are the closest thing to documentation available right now.
<hcarty> adrien: You could certainly have an extension to handle option types. You could either use a printer function which doesn't print anything for None, customize xstrp4_here.ml or write a custom extension.
<hcarty> adrien: If you don't have oasis I'll check the oasis-generated files in
<hcarty> adrien: Ah, oops... I've only checked in the oasis components. If you have oasis, then "oasis setup" then "ocaml setup.ml -configure && ocaml setup.ml -build"

2011-06-11

<adrien> hcarty: and is it possible to format with something like: function | None -> "" | Some x -> sprintf "FOO= %s" x ?
<adrien> hcarty: how do I build xstrp4? :P
<zorun> hcarty: awesome! the hash function must be pretty smart
<hcarty> zorun: In 3.12, you can store modules in a hash table too

2011-06-10

<likebike> Thank you hcarty. That was extremely helpful!
<hcarty> likebike: There are some very basic snippets on the wiki as well - https://github.com/ocaml-batteries-team/batteries-included/wiki/Getting-started
<hcarty> adrien: http://0ok.org/cgit/cgit.cgi/xstrp4/ to track development until something more formal happens. There is now basic support for custom xstrp4 expansions.

2011-06-09

<hcarty> And as nice as batteries.pa_string.syntax is, the code feels overly complex
<hcarty> It's not worth much for an example that short... but I have found sprintf/sprintf2's %a to be difficult to follow
<hcarty> thelema: Only cringe with excitement
<thelema> hcarty: is that xstrp4 example supposed to make me not cringe?
<thelema> hcarty: I put in a 2.0 beta, but am pulling it so a proper 2.0 beta can be put together
<thelema> hcarty: batteries in odb needs some love.
<hcarty> thelema: Batteries'd xstrp4 - print_endline <:batt<Integer list: ${[1;2;3], List.print Int.print}>>
<hcarty> thelema: odb is looking for 1.3.0 I think, but 2.0beta is provided
<hcarty> thelema: Batteries appears to be uninstallable from odb
<hcarty> Anarchos: I think I've read of such a thing, but I've never seen it
<hcarty> adrien: The "last mile" is the part that counts, clearly!
<Anarchos> hcarty there was MMM years (or decades) ago
<hcarty> adrien: Congratulations... is this the first OCaml-based web browser, or the first modern one?
<adrien> hcarty: I think I just won it :P
<hcarty> )
<hcarty> adrien: Good luck with your bet :-
<hcarty> thelema: I'll try to get Calendar ready for oasis-db as well
<hcarty> thelema: I thought I read about an oasisification of lablgtk2, but that may have been only a findlibification
<adrien> hcarty: no, not yet but I'll try this evening (but first I need to make some kind of "release" in order to win a bet)
<hcarty> adrien: Have you had a chance to look at xstrp4-dev?
<hcarty> thelema: Indeed
<thelema> hcarty: thanks, that alternate version installs fine with odb. Still need to get a findlib-enabled lablgtk2 into oasis-db
<hcarty> Both follow the main Cairo API fairly closely
<hcarty> The API is different. I'm not sure how much work it would be to port over, hopefully not too much
<hcarty> Likely not
<hcarty> thelema: Christophe wrote a new binding from scratch, with what appears to be a cleaner result
<thelema> hcarty: the ocaml-cairo that I find has version 1.2.0: http://cgit.freedesktop.org/cairo-ocaml/
<hcarty> thelema: There is a newer release (0.3.2) which includes a META file
<hcarty> adrien: For example, <:sql<select * from bar where baz = ${baz_val, s}>>
<hcarty> adrien: I think it may be reasonably straightfoward to make xstrp4 somewhat extensible, so you could write a few functions to get <:myquote<${foo,bar}>> to translate however you like
<hcarty> thelema: I've done that before while testing PLplot
<hcarty> thelema: I think you can configure it with a few environment variables
<hcarty> mart: You can setup local/home directory install locations, but I think there are some limitations
<thelema> hcarty: I think batStd was extlib's pervasives replacement, and somehow batteries grew a batPervasives independently
<hcarty> thelema: That was my impression A Long Time Ago
<hcarty> thelema: Is BatStd meant for use internally, while BatPervasives is meant for use externally?
<hcarty> gildor: And it provides a way to test oasis-db packages now!
<gildor> hcarty: i.e. someone else than me can do something useful with oasis-db content
<hcarty> Once I have these xstrp4 edits in a state I'm reasonably happy with I plan to put it up on oasis-db as well.
<gildor> hcarty: yep, but I am very happy that odb exist, it demonstrates that there are no lock-in
<hcarty> gildor: odb is already a nice proof-of-concept. I'm very much looking forward to the full oasis-db, particularly the local package/source tree support.
<gildor> hcarty: in less than 2 hours, I was able to publish a package (ocaml-radixtree), that can be installed with odb right now
<hcarty> thelema: I'm happy to do what I can
<thelema> hcarty: maybe you can explain it to me - I'm only at the point where I can use custom commands
<gildor> hcarty: you'll see that oasis-db is useful as well
<gildor> hcarty: thx
<hcarty> gildor: And for what it's worth, my initial impression of working with oasis for xstrp4 is very positive. The setup was simple and straightforward.
<hcarty> gildor: Ah, ok. Thank you!
<gildor> hcarty: the warnings is a bug, but already reported
<hcarty> But I do include the META plugin
<hcarty> With that done, the oasis-based compilation works. I do, however, get errors about XMETAType being set without the proper plugin being enabled.
<hcarty> gildor: Nevermind - I see that some extra editing of _tags is required outside of the _oasis file
<hcarty> gildor: I am trying to build xstrp4 with oasis to learn a bit of oasis
<hcarty> *missing
<hcarty> gildor: That is at least part of what I am misisng
<hcarty> gildor: I see that odn has "-syntax camlp4o" passed in when it is needed, but I don't see/understand what causes that flag to be enabled
<gildor> hcarty: though, it is far from perfect right now
<gildor> hcarty: have a look at ocaml-data-notation, it is a syntax extension
<hcarty> My naive attempt has failed - camlp4o is apparently not being used on the extension source code
<hcarty> gildor: Any pointers to documentation or examples on how to create a suitable _oasis definition for a syntax extension?
<hcarty> gildor: I suppose that makes sense :-)
<gildor> hcarty: debian first
<gildor> hcarty: yes, I know
<hcarty> gildor: Feature request - odn and oasis for GODI's 3.12 section, now that odn is 3.12-ready

2011-06-08

<hcarty> And email Gerd to see what his feelings are on the matter
<hcarty> thelema: I'll see if I can get oasis working here, now that odn has been updated in odb
<thelema> hcarty: yay
<hcarty> thelema: I will likely put a Batteries-ready form of this together as well so it is able to make easy use of the Foo.print functions.
<hcarty> And for what it's worth, the test/example code from earlier with the output: http://vpaste.net/uM7Rf?
<hcarty> adrien: One more update to the uploaded file. No functionality changes, but I did remove a few debugging print statements.
<hcarty> adrien: Post-sleep!
<adrien> hcarty: downloaded, I'll try it tomorrow
<hcarty> adrien: Ok, same URL. Should be fixed now.
<hcarty> I messed up something exporting the tar from git
<hcarty> adrien: Ooops, not yet...
<hcarty> Thank you, I'm glad you like it :-) I'm still trying to figure out why errors are not being reported in the proper locations.
<hcarty> Alright, I'll pack up and upload what I have
<hcarty> Timezones, always getting in the way of progress
<hcarty> adrien: http://vpaste.net/NDH1Z? -- an example
<hcarty> adrien: Any time/interest in trying out a modified xstrp4?
<adrien> hcarty: pong
<hcarty> adrien: ping

2011-06-06

<hcarty> zsparks: Top-level definitions/statements are run
<hcarty> oops
<hcarty> away

2011-06-02

<hcarty> s/position/error location/
<hcarty> adrien: I don't have position reporting working with this though... another part of camlp4 to figure out!
<hcarty> adrien: ${expr, expr} does seem to work, at least for some basic tests
<hcarty> I don't know if breaks are maintained in []
<hcarty> wrapping in [ ] may do it
<thelema_> hcarty: I don't know.
<hcarty> thelema_: Will that force a new paragraph as well?
<hcarty> Unless it's stable, of course
<hcarty> thelema_: I agree, although that one doesn't include what philtor was looking for (findlib and installation support)
<thelema_> hcarty: yeah, but this makes it pretty easy to decide among the three github branches, one of which is endorsed on the old google code page
<hcarty> For example, the README in the deriving fork linked above says, "The patches in these repository are propositions..."
<hcarty> Unless you pick an experimental fork someone is actively playing with
<hcarty> thelema_: For some definitions of canonical...
<hcarty> philtor: I don't think it's a problem with github, but a characteristic of forked projects in general
<hcarty> ocamlbuil: You shouldn't even need the _tags file if the OCaml installation is complete
<hcarty> There are at least two deriving repositories out there - one may have a META file
<hcarty> I may be able to make ${expr, expr} work, but I'm not certain about that. It seems like it could be pretty fragile. No harm in trying though.
<adrien> hcarty: ok, tell me when you're ready
<hcarty> If it stands up to a bit more testing I'll submit a patch to Gerd
<hcarty> adrien: A patch to the xstrp4 source code. No need to rush, as I would like to a bit more cleanup.
<hcarty> I definitely will look out for it
<adrien> hcarty: what does it involve? (I should finish some code first)
<hcarty> adrien: Any interest in testing the tweaked, any-expr-ready version?
<hcarty> adrien: I think my "fix" may have been to strip out everything but the <:here<>> quotation support :-)
<hcarty> adrien: I noticed that, but I don't remember if I found out why. I just picked up this project again a few minutes ago.
<adrien> hcarty: while you're at it, you might want to check why "file" becomes "forbidden" with xstrp4 while it shouldn't be anymore (xstrp4 used to define it but stopped one version ago afair)
<hcarty> supported types rather
<hcarty> But the values had to match the standard printf-like %d, %f, etc. supported values
<hcarty> Anarchos: xstrp4 is interesting, but it seemed somewhat limited. You could have Perl-like $var interpolation in strings.
<hcarty> Ack, I still typed it incorrectly... but it works
<hcarty> "let x = 3.14 in let s = <:here<$x, (fun () f -> string_of_float f)$>> in s" gives you the string "3.14" -- to correct a typo
<hcarty> "let x = 3.14 in let s = <:here<$x, (fun () f -> string_of_float f)>> in s" gives you the string "3.14"
<hcarty> Woo-hoo! I think I have it working at very least at the dirty hack level :-)
<Anarchos> hcarty we all were beginners at one time so no ridiculous questions
<hcarty> I'm still rather new to messing with OCaml syntax, so I apologize if any of these questions are ridiculous :-)
<hcarty> Does camlp4 have a string -> expr function? (if such a thing makes sense...)
<hcarty> Anarchos: That's probably the safest way to go.
<Anarchos> hcarty maybe look at the source of the lexer of the ocaml compiler itself ?
<hcarty> I'm looking at the xstrp4 syntax extension and trying to see if it is feasible to extend the syntax from ${id,optional_tag} ${expr, optional_expr}
<hcarty> Is there a simple/clean way to match an OCaml expression from ocamllex?

2011-06-01

<hcarty> Hooray!
<thelema> hcarty: absolutely, iirc someone already wrote a bunch of code for that, maybe bluestorm/gasche
<hcarty> type comparison_t = GT | LT | EQ (or better names)
<hcarty> thelema: Any chance we could have compare : 'a -> 'a -> comparision_t in some future Batteries release?
<adrien> hcarty: I think so, for ocamlnet at least
<hcarty> adrien: Ouch. Syntax issue, or something else?

2011-05-31

<hcarty> bluestorm: Thank you very much for your explanations
<hcarty> bluestorm: I need to go for a bit, but I hope to pick this back up here and on the list :-)
<hcarty> That seems like a rather limited focus though for a pervasive data type.
<hcarty> bluestorm: That makes sense. Thank you - I admit, I wasn't thinking about side-effects.
<hcarty> Not for the side-effects part though
<hcarty> Wouldn't Seq allow backtracking here as well?
<bluestorm> hcarty: speak early, speak often ^^
<hcarty> bluestorm: I'd like to have a better idea of why someone would use LazyList before I open my mouth too wide :-)
<thelema> hcarty: if you want 1--1E6, use Seq or Enum.
<thelema> hcarty: backtracking consumption
<hcarty> What is the use case for LazyList?
<hcarty> I don't want that memoized
<hcarty> I'm thinking of something like (1 -- 1_000_000)
<hcarty> Seq is a functional counterpart to Enum
<hcarty> Is that a bad thing?
<hcarty> bluestorm: Oops, yes
<hcarty> thelema: Why LinkedList over Seq?
<gildor> hcarty: AFAIK, default is 3.11 in GODI
<hcarty> bluestorm: godi supports 3.12, but I don't know what the default is
<thelema> hcarty: I dunno.
<thelema> hcarty: Okay, let's have a 1.9 release that makes big use of Future.
<hcarty> s/anyone/any distro/
<hcarty> Does anyone but Ubuntu have OCaml but not 3.12?
<hcarty> You require a very rapid release cycle, with potentially no non-Future changes, in order to keep users up to date if you put everything in batteries-stable
<hcarty> Packing everything in shipped batteries seems like it's asking for trouble
<thelema> hcarty: we could have that within the normal batteries -- [open Batteries_next] would be like [module List = struct include List include BatList include BatList.Future end
<hcarty> Sort of like sid is to Debian
<hcarty> bluestorm: batteries-next would always be "unstable" batteries
<thelema> hcarty: I don't like that idea so much
<bluestorm> hcarty, thelema plans to stick to semantic versioning and that means doing major releases "often"
<hcarty> Maybe that pre-2.0 should be a separate release then. findlib name "batteries-next" or similar.
<thelema> hcarty: it will, but not magically everything gets fixed, things will improve at the rate that people contribute
<hcarty> It would be nice if 2.0-final could be used to bring more consistency to Batteries.
<thelema> hcarty: 3.0 is always available to fix problems
<hcarty> thelema: But it would be bad to end up locked in to 2.0 compatibility with a bunch of half-baked changes
<hcarty> bluestorm: Thank you!
<bluestorm> hcarty, congratulations
<hcarty> My patch-fu is rather limited these days. New baby, so not a lot of coding time outside of work.
<thelema> hcarty: seq seems like a wierd compromise between enum and lazylist, I don't mind it being available for those who need exactly it, but think that enum and ll should be more pervasive
<hcarty> bluestorm: I think ( --. ) for all appropriate modules (numbers, others?) could be helpful
<hcarty> thelema: Or Seq
<thelema> hcarty: maybe Foo.Op?
<hcarty> bluestorm: So pre-3.12 can "open Foo.Infix" for minimal impact, and 3.12+ can use Foo.(...) for access to operators and functions
<thelema> hcarty: I agree about enum being surprising. Maybe we need to emphasize more it's not a lazy list, and encourage more use of lazy list
<hcarty> bluestorm: Yes, and if I remember it correctly I agree with the idea of having Foo.Infix (or .Operator or whatever name is used) and then include Foo.Infix at the end of Foo
<hcarty> thelema: In that case keeping the operators in Pervasives as well may not be such a bad idea. I still think that Enum is more surprising than it should be though.
<bluestorm> hcarty, have you read this mailing-list thread? https://lists.forge.ocamlcore.org/pipermail/batteries-devel/2011-May/001211.html
<hcarty> But if 2.0 requires OCaml 3.12 then it's less of an issue since you get local module open
<hcarty> This would be a 2.0ism
<hcarty> bluestorm: Yes