Re: I don't want to maintain this

2005-12-06 Thread Marius Vollmer
Kevin Ryde [EMAIL PROTECTED] writes:

 Bruce Korb [EMAIL PROTECTED] writes:

 ERROR: Wrong type argument in position 1: #unspecified

 Ah, I see 1.7 now throws an error for a non-number argument to
 inexact?, where 1.6 would accept anything.

 Looks like a deliberate change 2003-11-19 Marius Vollmer, maybe he
 can say what motivated it.

The 1.7 behavior is what R5RS specifies.

-- 
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3  331E FAF8 226A D5D4 E405


___
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


Re: I don't want to maintain this

2005-11-30 Thread Ludovic Courtès
Hi Bruce,

Bruce Korb [EMAIL PROTECTED] writes:

 *I* certainly cannot.

Do you mean that you don't *want* to, or that this is not possible?

The point is that writing Scheme code will always be easier than writing
C code, and maintaining it will be even more easier.

 And I do not understand the usage of the file
 argument.  What I am doing is extracting Scheme code from an encompassing
 template and handing it off for evaluation.  My program is reading the
 file, not Guile.  When I hand off the the string for evaluation, I hand
 it to that ugly thing that I do not want to maintain.  I do this in
 exactly the same way as one would with scm_c_eval_string, except I have
 the additional parameters file name and line number.  Perhaps I could
 wrap my strings in something like this:

 char* fmt =
 (read-enable 'positions)
 (format #t \evaluating `~a' from ~a:~a:~a~%%\
 sexp (port-filename (current-input-port))
(source-property sexp \%s\)
(source-property sexp %d))
 (begin
%s
 );

 and use it thus:

sprintf( buf, fmt, filename, linenum, script );
result = scm_c_eval_string( buf );

 Would that work?

That might work, but that's ugly.  Are you evaluating reading a file
and evaluating it from C code?

Even if this is the case, nothing prevents you from writing your own
read/eval function in Scheme (along the lines of what I posted earlier)
and using it from C:

  eval_proc = scm_c_eval_string (eval-from-file);
  result = scm_call_1 (eval_proc, scm_from_locale_string (the-file.scm));

Hope this helps,
Ludovic.


___
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel