Commit Graph

62 Commits

Author SHA1 Message Date
Kartik Agaram b2e36ec827 4418
Use 'dump' consistently to mean 'to screen' (stderr), and 'save' to mean
'to disk'.
2018-07-26 09:03:13 -07:00
Kartik Agaram f5ee2463d0 4264
Undo the relayout of 4259.
2018-06-17 16:23:14 -07:00
Kartik Agaram 5859d7056c 4259 2018-06-16 09:25:47 -07:00
Kartik K. Agaram d51abbf123 4139 2017-12-05 01:15:10 -08:00
Kartik K. Agaram 26b4bdc8b3 4138 2017-12-05 01:09:19 -08:00
Kartik K. Agaram 2b25071710 3877 2017-05-26 17:36:16 -07:00
Kartik K. Agaram 6515192306 3694
Fix CI, broken by commit 3691.
2016-11-26 20:44:52 -08:00
Kartik K. Agaram ff92e434b8 3691
Expand 'assert' to handle non-literal texts.
2016-11-25 22:14:04 -08:00
Kartik K. Agaram 17401c3854 3671 - support text in '$print' 2016-11-12 01:05:38 -08:00
Kartik K. Agaram e41e8e09e6 3669 2016-11-11 23:30:37 -08:00
Kartik K. Agaram 9a81d7460f 3561 2016-10-22 16:56:07 -07:00
Kartik K. Agaram 6c96a437ce 3522 2016-10-19 22:10:35 -07:00
Kartik K. Agaram 192d59d3bb 3380
One more place we were missing expanding type abbreviations: inside
container definitions.
2016-09-17 00:43:20 -07:00
Kartik K. Agaram 78c5020531 3374 2016-09-16 23:57:55 -07:00
Kartik K. Agaram cf3ac87f17 3163
Experimental: kinda support $print in console mode.

It's not perfect and probably will never be, because 'cout' buffers
differently from termbox primitives, which can cause console-aware
newlines to show up before other (console-oblivious) prints, like in
this example program:

  def main [
    open-console
    $print [abc], 10/newline
    $print [def], 10/newline
    wait-for-some-interaction
    close-console
  ]

And then there's the problem that there's no way for cout to update
Display_column. So mixing $print and print will be confusing.

Perhaps we should just not mess with Display_* variables inside $print?
But then we'll only ever be able to see a single line of $print at a
time.
2016-08-09 16:48:49 -07:00
Kartik K. Agaram 8d72e56521 3120
Always show instruction before any transforms in error messages.

This is likely going to make some errors unclear because they *need* to
show the original instruction. But if we don't have tests for those
situations did they ever really work?
2016-07-21 19:22:03 -07:00
Kartik K. Agaram f28f2636c6 3101 - purge .traces/ dir from repo history
I'd been toying with this idea for some time now given how large the
repo had been growing. The final straw was noticing that people cloning
the repo were having to wait *5 minutes*! That's not good, particularly
for a project with 'tiny' in its description. After purging .traces/
clone time drops to 7 seconds in my tests.

Major issue: some commits refer to .traces/ but don't really change
anything there. That could get confusing :/

Minor issues:

a) I've linked inside commits on GitHub like a half-dozen times online
or over email. Those links are now liable to eventually break. (I seem
to recall GitHub keeps them around as long as they get used at least
once every 60 days, or something like that.)

b) Numbering of commits is messed up because some commits only had
changes to the .traces/ sub-directory.
2016-07-05 00:53:12 -07:00
Kartik K. Agaram 5f0280a90d 2998 2016-05-24 18:32:18 -07:00
Kartik K. Agaram 9dcbec398c 2990
Standardize quotes around reagents in error messages.

I'm still sure there's issues. For example, the messages when
type-checking 'copy'. I'm not putting quotes around them because in
layer 60 I end up creating dilated reagents, and then it's a bit much to
have quotes and (two kinds of) brackets. But I'm sure I'm doing that
somewhere..
2016-05-20 22:11:34 -07:00
Kartik K. Agaram ac8acc7b05 2954 - bugfix: $system
The actual fix is in the layer rewriting literal strings.
2016-05-11 19:31:37 -07:00
Kartik K. Agaram 43b866d199 2932
More consistent labeling of waypoints. Use types only when you need to
distinguish between function overloadings. Otherwise just use variable
names unless it's truly not apparent what they are (like that the result
is a recipe in "End Rewrite Instruction").
2016-05-06 08:33:15 -07:00
Kartik K. Agaram 0ce24b2689 2850 2016-04-20 20:07:50 -07:00
Kartik K. Agaram acc4792d2f 2803
Show more thorough information about instructions in the trace, but keep
the original form in error messages.
2016-03-21 02:25:52 -07:00
Kartik K. Agaram b24eb4766a 2773 - switch to 'int'
This should eradicate the issue of 2771.
2016-03-13 20:26:47 -07:00
Kartik K. Agaram 1ead356219 2735 - define recipes using 'def'
I'm dropping all mention of 'recipe' terminology from the Readme. That
way I hope to avoid further bike-shedding discussions while I very
slowly decide on the right terminology with my students.

I could be smarter in my error messages and use 'recipe' when code uses
it and 'function' otherwise. But what about other words like ingredient?
It would all add complexity that I'm not yet sure is worthwhile. But I
do want separate experiences for veteran programmers reading about Mu on
github and for people learning programming using Mu.
2016-03-08 01:46:47 -08:00
Kartik K. Agaram 1b76245c63 2712 2016-02-26 13:04:55 -08:00
Kartik K. Agaram a0b9fa55a0 2704 - eradicate all mention of warnings from core 2016-02-25 11:29:42 -08:00
Kartik K. Agaram 9f95c7451b 2685
Stack of plans for cleaning up replace_type_ingredients() and a couple
of other things, from main problem to subproblems:

  include type names in the type_tree rather than in the separate properties vector
  make type_tree and string_tree real cons cells, with separate leaf nodes
  redo the vocabulary for dumping various objects:
    do we really need to_string and debug_string?
    can we have a version with *all* information?
    can we have to_string not call debug_string?

This commit nibbles at the edges of the final task, switching from
member method syntax to global function like almost everything else. I'm
mostly using methods just for STL in this project.
2016-02-19 13:42:45 -08:00
Kartik K. Agaram 07a6418389 2623 - bugfix: editing sandboxes
If you restore 2 sandboxes, the first render was setting
response-starting-row-on-screen on both, without ever rendering a
response. If the lower sandbox contained a print and rendered the screen
instead of the response, the original response-starting-row-on-screen
was never reset. If the process of running the sandboxes caused the
lower sandbox's title bar to move below the now-stale
response-starting-row-on-screen[1], editing the lower sandbox no longer
works.

[1] (Either because the upper sandbox prints to screen as well (causing
the first F4 to move the lower sandbox down by several lines), or
because a fresh sandbox is created with several lines before the first
F4 is hit.)

Current solution: never set response-starting-row-on-screen during
reload (or otherwise when there's no response).

This is hard to test right now because 'restore' is not a tested
interface, and I can't come up with another situation where the
response-starting-row-on-screen goes stale. So I'm now trying to keep
all changes to response-starting-row-on-screen close together. Another
idea is to add a check that the click row lies below the
response-starting row *and* above the start of the next sandbox. (But
what if there's no next sandbox?)

(This bug is really a regression, introduced last Sep in 2163.)
2016-02-01 13:37:12 -08:00
Kartik K. Agaram 601ff75bc7 three bugs fixed
- notes
bug in edit/ triggers in immutable but not master branch
bug triggered by changes to layer 059: we're finding an unspecialized call to 'length' in 'append_6'

hard to debug because trace isn't complete
just bring out the big hammer: use a new log file

length_2 from recipes.mu is not being deleted (bug #1)
so reload doesn't switch length to length_2 when variant_already_exists (bug #2)
so we end up saving in Recipe for a primitive ordinal
so no valid specialization is found for 'length' (bug #3)

why doesn't it trigger in a non-interactive scenario?
argh, wasn't checking for an empty line at end. ok, confidence restored.
2015-12-15 10:20:41 -08:00
Kartik K. Agaram 3c67fedb9b 2490 2015-11-28 00:36:37 -08:00
Kartik K. Agaram bb7142dbc4 2475 - allow addresses to be converted to numbers
It's just the other direction we want to avoid.
2015-11-27 10:32:34 -08:00
Kartik K. Agaram c55e49b637 2445 - dispatch between shape-shifting variants
Starting to leave debug prints around once again, just in case one of
them is worth promoting to the trace..
2015-11-15 12:35:59 -08:00
Kartik K. Agaram 795f5244ab 2377 - stop using operator[] in map
I'm still seeing all sorts of failures in turning on layer 11 of edit/,
so I'm backing away and nailing down every culprit I run into. First up:
stop accidentally inserting empty objects into maps during lookups.

Commands run:
  $ sed -i 's/\(Recipe_ordinal\|Recipe\|Type_ordinal\|Type\|Memory\)\[\([^]]*\)\] = \(.*\);/put(\1, \2, \3);/' 0[1-9]*
  $ vi 075scenario_console.cc  # manually fix up Memory[Memory[CONSOLE]]
  $ sed -i 's/\(Memory\)\[\([^]]*\)\]/get_or_insert(\1, \2)/' 0[1-9]*
  $ sed -i 's/\(Recipe_ordinal\|Type_ordinal\)\[\([^]]*\)\]/get(\1, \2)/' 0[1-9]*
  $ sed -i 's/\(Recipe\|Type\)\[\([^]]*\)\]/get(\1, \2)/' 0[1-9]*

Now mu dies pretty quickly because of all the places I try to lookup a
missing value.
2015-11-06 11:17:25 -08:00
Kartik K. Agaram a85f98b7b7 2347 2015-11-02 09:01:00 -08:00
Kartik K. Agaram cdd6fd0967 2313 2015-10-29 12:09:23 -07:00
Kartik K. Agaram 61286c8d69 2272 2015-10-19 15:53:09 -07:00
Kartik K. Agaram 77cdc6d03f 2271 - bugfix: traces cross-contaminating errors
There were several places where we push a call on to a routine without
incrementing call-stack depth, which was used to compute the depth at
which to trace an instruction. So sometimes you ended up one depth lower
than you started a call with. Do this enough times and instructions that
should be traced at level 100 end up at level 0 and pop up as errors.

Solution: since call-stack depth is only used for tracing, include it in
the trace stream and make sure we reset it along with the trace stream.
Then catch all places where we forget to increment call-stack depth and
make sure we catch such places in the future.

When I first ran into this with Caleb I thought there must be some way
that we're writing some output into the warnings result. I didn't
recognize that the spurious output as part of the trace, just at the
wrong level.
2015-10-19 15:45:55 -07:00
Kartik K. Agaram e00d485428 2260 - start tracing by depth rather than label
Now we can collect all traces, just modulating the depth.
2015-10-06 23:38:28 -07:00
Kartik K. Agaram 5f98a10cc7 2258 - separate warnings from errors
At the lowest level I'm reluctantly starting to see the need for errors
that stop the program in its tracks. Only way to avoid memory corruption
and security issues. But beyond that core I still want to be as lenient
as possible at higher levels of abstraction.
2015-10-06 22:15:45 -07:00
Kartik K. Agaram 164bf99fef 2253 - start reorganizing traces 2015-10-05 22:50:58 -07:00
Kartik K. Agaram 166e3c0d40 2232 2015-10-01 17:30:14 -07:00
Kartik K. Agaram 4814bf94e7 2226 - standardize warning format
Always show recipe name where error occurred. But don't show internal
'interactive' name for sandboxes, that's just confusing.

What started out as warnings are now ossifying into errors that halt all
execution. Is this how things went with C and Unix as well?
2015-10-01 13:13:10 -07:00
Kartik K. Agaram 5fdd8e96ad 2225 2015-10-01 00:13:45 -07:00
Kartik K. Agaram 4082acd24f 2199 - stop printing numbers in scientific notation
Turns out the default format for printing floating point numbers is
neither 'scientific' nor 'fixed' even though those are the only two
options offered. Reading the C++ standard I found out that the default
(modulo locale changes) is basically the same as the printf "%g" format.
And "%g" is basically the shorter of:
  a) %f with trailing zeros trimmed
  b) %e
So we'll just do %f and trim trailing zeros.
2015-09-14 23:37:12 -07:00
Kartik K. Agaram 6c1376f830 2095
Finally terminate the experiment of keeping debug prints around. I'm
also going to give up on maintaining counts.

What we really need is two kinds of tracing:
  a) For tests, just the domain-specific facts, organized by labels.
  b) For debugging, just transient dumps to stdout.
b) only works if stdout is clean by default.

Hmm, I think this means 'stash' should be the transient kind of trace.
2015-08-28 23:25:21 -07:00
Kartik K. Agaram 380b0b6366 2079
Cleanup 2078.
2015-08-26 01:43:43 -07:00
Kartik K. Agaram 81b1975fc5 2078 - update entire screen on tb_present()
Termbox had been taking shortcuts when it thinks the screen hasn't
changed, which doesn't work if some other process messes up the screen.

The Go version has a Sync method in addition to Flush/tb_present for
precisely this eventuality. But it feels like an unnecessary
optimization given C's general speed. Just drop it altogether.

---

This took me a long time to track down, and interestingly I found myself
writing a new tracing primitive before I remembered how to selectively
trace just certain layers during manual tests. I'm scared of generating
traces not because of performance but because of the visual noise. Be
aware of this. I'm going to clean up $log now.

Maybe I should also stop using $print..
2015-08-26 01:21:41 -07:00
Kartik K. Agaram 086acf397f 2064
Adjust spaces in 'stash'.
2015-08-24 13:40:21 -07:00
Kartik K. Agaram 65b3db5d59 1990 - extra ingredient for 'trace' depth
Now we can make use of all the depths from 1 to 99.
2015-08-13 16:53:32 -07:00