Using process substitution to trick programs expecting files, with specific extensions as argument?

A possibility would be to point melt to a filesystem that shows modified copies of files. FUSE is a generic way to build filesystem driver implemented by an ordinary program and requiring no privileges. There are many FUSE filesystems around, and there's a good chance that one of them can help you. The idea is to provide a mount point where reading a .melt file reads the “real” file but with comments filtered out.

ScriptFS looks promising (but I've never used it). Something like this should work:

mkdir ~/uncommented-melt
scriptfs -p "$HOME/bin/uncomment-melt;&*.melt" ~/work ~/uncommented-melt

where ~/work is the root of the tree that contains your .melt files and ~/bin/uncomment-melt is

#!/bin/sh
sed 's/#.*$//' "$1"

Then if you have a file ~/work/test_c.melt with comments, you can run melt ~/uncommented-melt/test_c.melt.

Other potential helpful FUSE filesystems:

  • Execfuse — lets you build a simple FUSE driver with shell scripts
  • AVFS or other FUSE filesystems that transparently uncompress files: define the stripping of comments as an uncompression rule.

With the zsh shell, you can use the =(...) form of process substitution (which uses temporary files instead of /dev/fd/x files and pipes) for which you can specify a suffix:

(TMPSUFFIX=.melt; melt =(sed 's/#.*$//' test_c.melt))

See info zsh TMPSUFFIX (assuming the info pages are installed, you may need to install a zsh-doc package) for details.